patch for segfault freeing uninitialized memory

Filippo ARCIDIACONO filippo.arcidiacono at st.com
Thu Mar 29 08:27:44 UTC 2012



> 
> Note that this patch avoids the segfault.  However, my guess is that there
> might still be some code in this area which is not working.  Looking at
the GNU
> C library it initializes the structure with the C locale if no other
> locale is specified.

Your patch seems reasonable. Do you have a minimal test case that spot the
issue that
could be inserted in the uClibc testsuite?
To note, also in uClibc the default locale is "C". The main difference Vs
glibc is,
the latter maps the relative locale file when you want to use a specific
locale,
while in uClibc the locale are in a global structure of the C lib configured
at build
time.
In general since Manuel Nova stopped to contribute to the uClibc, the locale
stuff didn't
change much. On the other hand this code remained WIP, so if you have any
evidence of other
bug and/or enhancement, do not hesitate to post.

> 
> --- uClibc-0.9.32/libc/misc/locale/locale.c	2011-06-08
> 14:35:20.000000000 -0500
> +++ uClibc-0.9.32-modified/libc/misc/locale/locale.c	2012-03-18
> 15:23:09.000000000 -0500
> @@ -1295,6 +1295,7 @@
>  		base = malloc(sizeof(struct __uclibc_locale_struct));
>  		if (base == NULL)
>  			return base;
> +                memset(base, 0, sizeof(struct
> __uclibc_locale_struct));
>  		_locale_init_l(base);
>  	}
> 
> 
> I wrote this as a bug but I thought it might be appropriate to also
> send the patch to the list.
> 
> The bug is here: https://bugs.busybox.net/show_bug.cgi?id=4964
> 
> --
> Sincerely,
> 
> Eric Nadler
> Senior Software Engineer
> WatchGuard Video
> 
> (469) 867-3735  Mobile
> (972) 423-9778  Fax
> ENadler at WatchGuardVideo.com
> http://www.WatchGuardVideo.com
> Visit our New Blog! <http://watchguardvideo.wordpress.com>
> 
> 415 Century Parkway, Allen, TX 75013
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc



More information about the uClibc mailing list