[uClibc-cvs] uClibc/ldso/ldso readelflib1.c,1.52,1.53
Erik Andersen
andersen at uclibc.org
Wed Dec 17 06:41:22 UTC 2003
Update of /var/cvs/uClibc/ldso/ldso
In directory nail:/tmp/cvs-serv22282
Modified Files:
readelflib1.c
Log Message:
When I switched from using stack allocated space for printf, I missed a case
where a sizeof(foo) was changed to the sizeof a pointer. This caused
_dl_printf to complain a lot when debug is enabled (which itself revealed a bug
since it should have exited on buffer overflow), and let me to find another
bug, where memory failures would try to recursively call _dl_printf....
What a mess.
Index: readelflib1.c
===================================================================
RCS file: /var/cvs/uClibc/ldso/ldso/readelflib1.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- readelflib1.c 5 Dec 2003 20:24:26 -0000 1.52
+++ readelflib1.c 17 Dec 2003 06:41:20 -0000 1.53
@@ -787,7 +787,7 @@
buf = _dl_mmap((void *) 0, 4096, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (_dl_mmap_check_error(buf)) {
- _dl_dprintf(2, "%s: mmap of a spare page failed!\n", _dl_progname);
+ _dl_write(fd, "mmap of a spare page failed!\n", 29);
_dl_exit(20);
}
@@ -796,8 +796,10 @@
if (!fmt)
return;
- if (_dl_strlen(fmt) >= (sizeof(buf) - 1))
- _dl_write(fd, "(overflow)\n", 10);
+ if (_dl_strlen(fmt) >= (4096 - 1)) {
+ _dl_write(fd, "overflow\n", 11);
+ _dl_exit(20);
+ }
_dl_strcpy(buf, fmt);
va_start(args, fmt);
More information about the uClibc-cvs
mailing list