Commit 5d36191e authored by Mark Fasheh's avatar Mark Fasheh

detect_ht(): add a couple of defensive checks

Signed-off-by: 's avatarMark Fasheh <mfasheh@suse.de>
parent dc198686
......@@ -213,6 +213,8 @@ static int detect_ht(void)
/* Strip leading and trailing whitespace from val. */
while (isspace(*val) && *val != '\0')
val++;
if (*val == '\0')
continue;
c = &val[strlen(val) - 1];
while (isspace(*c) && c >= val) {
*c = '\0';
......@@ -230,7 +232,10 @@ static int detect_ht(void)
c = strchr(flag, FLAGS_DELIM);
if (c) {
*c = '\0';
c++;
if (c < &line[LINE_MAX])
c++;
else
c = NULL;
}
// printf("\"flag: %s\"\n", flag);
if (!strcmp(flag, HT_FLAG))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment