[BusyBox] Segmentation fault in "yes"

Pavel Roskin pavel_roskin at geocities.com
Fri Jun 2 15:26:28 UTC 2000


Hello!

"busybox yes" crashes if no arguments are given. The fix is trivial (but I
took the liberty of adding some spaces for the sake of readability)

=============================
diff -u -r1.3 yes.c
--- yes.c	2000/05/17 20:57:42	1.3
+++ yes.c	2000/06/02 15:13:01
@@ -27,7 +27,7 @@
 {
 	int i;
 
-	if (argc >=1 && *argv[1]=='-') {
+	if (argc >= 2 && *argv[1] == '-') {
 		usage("yes [OPTION]... [STRING]...\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
 				"\nRepeatedly outputs a line with all specified STRING(s), or `y'.\n"
=============================

Regards,
Pavel Roskin






More information about the busybox mailing list