1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dthelp/FormatUtils: fix coredump in dthelpgen due to free() of a bad address

This commit is contained in:
Jon Trulson 2018-04-10 16:30:25 -06:00
parent 88cbe518a4
commit f4e3cb8327

View file

@ -583,13 +583,11 @@ _DtHelpGetNxtToken (
/* Str is pointing at the start of the next token. Depending on the /* Str is pointing at the start of the next token. Depending on the
type of token, malloc the memory and copy the token value. */ type of token, malloc the memory and copy the token value. */
if (*str == '\0') if (*str == '\0')
token = str; token = strdup(str);
else if (*str == '\n') { else if (*str == '\n') {
token = str; token = strdup(str);
str++; str++;
} }
else { else {
/* We have some non-whitespace characters. Find the end of */ /* We have some non-whitespace characters. Find the end of */
/* them and copy them into new memory. */ /* them and copy them into new memory. */