commit ef744db382118260cf1a9da998c9bcf9b564bd3b from: Stefan Sperling date: Thu Aug 27 10:18:21 2020 UTC in got_object_commit_get_logmsg(), handle log messages which lack '\n' found by tracey's scan-build commit - d6b7d054e9c172e12fdf036e78bcc482ea257c8f commit + ef744db382118260cf1a9da998c9bcf9b564bd3b blob - 032e9030441206d1d8bfd8ec7621c1fa28019a05 blob + 25e255c01bc3216b952b7725a75edfd91082184c --- lib/object_parse.c +++ lib/object_parse.c @@ -475,6 +475,15 @@ got_object_commit_get_logmsg(char **logmsg, struct got } while (line); + if (*logmsg == NULL) { + /* log message does not contain \n */ + *logmsg = strdup(commit->logmsg); + if (*logmsg == NULL) { + err = got_error_from_errno("strdup"); + goto done; + } + } + /* Trim redundant trailing whitespace. */ len = strlen(*logmsg); while (len > 1 && isspace((unsigned char)(*logmsg)[len - 2]) &&