]> granicus.if.org Git - sudo/commitdiff
Fix underflow in get_ipa_hostname() when trimming trailing
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 15 Sep 2016 11:54:53 +0000 (05:54 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 15 Sep 2016 11:54:53 +0000 (05:54 -0600)
whitespace.

plugins/sudoers/sssd.c

index d616b8514757d42360018f4f6663c70388d1832c..ffb8e0f2da1ad9fe84c39dde23d5bfb8893d4bfb 100644 (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++;