Fix underflow in get_ipa_hostname() when trimming trailing

whitespace.
This commit is contained in:
Todd C. Miller
2016-09-15 05:54:53 -06:00
parent 394485f279
commit 37099a6e7d

View File

@@ -315,7 +315,7 @@ get_ipa_hostname(char **shostp, char **lhostp)
char *cp = line;
/* Trim trailing and leading spaces. */
while (isspace((unsigned char)line[len - 1]))
while (len > 0 && isspace((unsigned char)line[len - 1]))
line[--len] = '\0';
while (isspace((unsigned char)*cp))
cp++;