Fix underflow in get_ipa_hostname() when trimming trailing
whitespace.
This commit is contained in:
@@ -315,7 +315,7 @@ get_ipa_hostname(char **shostp, char **lhostp)
|
|||||||
char *cp = line;
|
char *cp = line;
|
||||||
|
|
||||||
/* Trim trailing and leading spaces. */
|
/* Trim trailing and leading spaces. */
|
||||||
while (isspace((unsigned char)line[len - 1]))
|
while (len > 0 && isspace((unsigned char)line[len - 1]))
|
||||||
line[--len] = '\0';
|
line[--len] = '\0';
|
||||||
while (isspace((unsigned char)*cp))
|
while (isspace((unsigned char)*cp))
|
||||||
cp++;
|
cp++;
|
||||||
|
Reference in New Issue
Block a user