diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-09-16 07:31:32 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-09-16 07:31:32 -0700 |
commit | 3cdb65b4e15141e675cd7003f94f24b829422927 (patch) | |
tree | 3f1c77953565b3b51dddf3829b6c5f93b7fae42c /man2html | |
parent | 278212c32f07e5970f88bd17375fba75ebbb8ea8 (diff) | |
download | man-3cdb65b4e15141e675cd7003f94f24b829422927.tar.gz man-3cdb65b4e15141e675cd7003f94f24b829422927.tar.bz2 man-3cdb65b4e15141e675cd7003f94f24b829422927.zip |
Fix realloc related crash. Abort on error.
Diffstat (limited to 'man2html')
-rw-r--r-- | man2html/man2html.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/man2html/man2html.c b/man2html/man2html.c index d3a0115..1a9309e 100644 --- a/man2html/man2html.c +++ b/man2html/man2html.c @@ -353,9 +353,12 @@ out_html(char *c) { } if (scaninbuff) { while (*c) { - if (buffpos >= buffmax) { - buffer = xrealloc(buffer, buffmax*2); - buffmax = buffmax*2; + while (buffpos >= buffmax) { + if (buffmax == 0) + buffmax = 32; + else + buffmax *= 2; + buffer = xrealloc(buffer, buffmax); } if (*c != '\a') buffer[buffpos++] = *c; @@ -3135,7 +3138,7 @@ error_page(char *s, char *t, ...) { vfprintf(stdout, t, p); va_end(p); printf("</BODY></HTML>\n"); - exit(0); + abort(); } char * |