From f4e3cb8327542318fe813dae87eccc1598fe77e3 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Tue, 10 Apr 2018 16:30:25 -0600 Subject: [PATCH] dthelp/FormatUtils: fix coredump in dthelpgen due to free() of a bad address --- cde/lib/DtHelp/FormatUtil.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cde/lib/DtHelp/FormatUtil.c b/cde/lib/DtHelp/FormatUtil.c index 21543d21..e55e158d 100644 --- a/cde/lib/DtHelp/FormatUtil.c +++ b/cde/lib/DtHelp/FormatUtil.c @@ -583,13 +583,11 @@ _DtHelpGetNxtToken ( /* Str is pointing at the start of the next token. Depending on the type of token, malloc the memory and copy the token value. */ if (*str == '\0') - token = str; - + token = strdup(str); else if (*str == '\n') { - token = str; + token = strdup(str); str++; } - else { /* We have some non-whitespace characters. Find the end of */ /* them and copy them into new memory. */ -- 2.25.1