Skip to content

Commit af58de4

Browse files
committed
wordsplit: use endstr when checking for quoted chars
This is more correct since we may be passed a sub-string. It is not a security issue since we are always working with a NUL-terminated C string. Reported by Reaxx.
1 parent a30f11c commit af58de4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/sudoers/editor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ wordsplit(const char *str, const char *endstr, const char **last)
7373

7474
/* Scan str until we encounter white space. */
7575
for (cp = str; cp < endstr; cp++) {
76-
if (cp[0] == '\\' && cp[1] != '\0') {
76+
if (*cp == '\\' && cp + 1 < endstr) {
7777
/* quoted char, do not interpret */
7878
cp++;
7979
continue;

0 commit comments

Comments
 (0)