[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] [PATCH] Fix ash+uClibC crash
From:       Pantelis Antoniou <panto () intracom ! gr>
Date:       2004-08-31 13:45:49
Message-ID: 4134810D.3000609 () intracom ! gr
[Download RAW message or body]

Hi there.

The following patch fixes a crash when using ash+uClibC.

For some reason environ is set to NULL initially, which caused
a crash very early.

The patch is against busybox-1.00-rc3 while the version
of uClibC is uClibc-0.9.26.

Regards

Pantelis

["crash-uclibc.diff" (text/x-patch)]

diff -ruN busybox-1.00-rc3-orig/shell/ash.c busybox-1.00-rc3-work/shell/ash.c
--- busybox-1.00-rc3-orig/shell/ash.c	2004-08-06 04:49:04.000000000 +0300
+++ busybox-1.00-rc3-work/shell/ash.c	2004-08-31 16:22:57.359146768 +0300
@@ -1722,7 +1722,8 @@
 	      char ppid[32];
 
 	      initvar();
-	      for (envp = environ ; *envp ; envp++) {
+
+	      for (envp = environ ; envp && *envp ; envp++) {
 		      if (strchr(*envp, '=')) {
 			      setvareq(*envp, VEXPORT|VTEXTFIXED);
 		      }
diff -ruN busybox-1.00-rc3-orig/shell/lash.c busybox-1.00-rc3-work/shell/lash.c
--- busybox-1.00-rc3-orig/shell/lash.c	2004-08-16 11:38:34.000000000 +0300
+++ busybox-1.00-rc3-work/shell/lash.c	2004-08-31 16:19:14.432036840 +0300
@@ -390,7 +390,7 @@
 
 	if (v == NULL) {
 		char **e;
-		for (e = environ; *e; e++) {
+		for (e = environ; e && *e; e++) {
 			puts(*e);
 		}
 		return 0;


_______________________________________________
busybox mailing list
busybox@mail.busybox.net
http://codepoet.org/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic