--- a/ldso/ldso/dl-elf.c 2012-05-15 09:20:09.000000000 +0200 +++ b/ldso/ldso/dl-elf.c 2014-11-11 11:58:14.267839390 +0100 @@ -1007,6 +1007,7 @@ } /* Minimal printf which handles only %s, %d, and %x */ +#define _DL_PRINTF_BUFLEN 256 void _dl_dprintf(int fd, const char *fmt, ...) { #if __WORDSIZE > 32 @@ -1016,23 +1017,16 @@ #endif va_list args; char *start, *ptr, *string; - char *buf; + char buf[_DL_PRINTF_BUFLEN]; if (!fmt) return; - buf = _dl_mmap((void *) 0, _dl_pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (_dl_mmap_check_error(buf)) { - _dl_write(fd, "mmap of a spare page failed!\n", 29); - _dl_exit(20); - } - start = ptr = buf; - if (_dl_strlen(fmt) >= (_dl_pagesize - 1)) { + if (_dl_strlen(fmt) >= (_DL_PRINTF_BUFLEN - 1)) { _dl_write(fd, "overflow\n", 11); - _dl_exit(20); + return; } _dl_strcpy(buf, fmt); @@ -1094,7 +1088,6 @@ start = NULL; } } - _dl_munmap(buf, _dl_pagesize); return; } @@ -1105,7 +1098,9 @@ len = _dl_strlen(string); retval = _dl_malloc(len + 1); - _dl_strcpy(retval, string); + if (retval != NULL) { + _dl_strcpy(retval, string); + } return retval; } --- a/ldso/ldso/ldso.c 2012-05-15 09:20:09.000000000 +0200 +++ b/ldso/ldso/ldso.c 2014-11-11 11:55:39.119840469 +0100 @@ -248,7 +248,7 @@ PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_UNINITIALIZE, -1, 0); if (_dl_mmap_check_error(_dl_mmap_zero)) { _dl_dprintf(_dl_debug_file, "%s: mmap of a spare page failed!\n", _dl_progname); - _dl_exit(20); + return NULL; } } retval = _dl_malloc_addr;