1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

* utils.c (aprintf): print log message and abort if we have too big text buffer.

This commit is contained in:
Alexander Dergachev 2008-04-12 19:13:23 +04:00
parent 311f76645f
commit 0e7917cda7

View File

@ -213,7 +213,11 @@ aprintf (const char *fmt, ...)
if (size >= FMT_MAX_LENGTH) /* We have a huge buffer, */ if (size >= FMT_MAX_LENGTH) /* We have a huge buffer, */
{ /* maybe we have some wrong format string? */ { /* maybe we have some wrong format string? */
free (str); /* In this case we must free already allocated memory, */ free (str); /* In this case we must free already allocated memory, */
return NULL; /* and return NULL pointer... */ logprintf (LOG_ALWAYS,
_("%s: aprintf: text buffer is too big (%ld bytes), \
free already allocated memory and abort.\n"),
exec_name, size); /* printout a log message */
abort (); /* and abort... */
} }
/* else, we continue to grow our buffer. */ /* else, we continue to grow our buffer. */
size <<= 1; /* twice the old size */ size <<= 1; /* twice the old size */