Skip to content

Commit 8a40a50

Browse files
committed
sudo_rfc1938_setup: fix out of bounds read if the prompt is ""
Reported by and fix from Aaron Esau.
1 parent 40217ea commit 8a40a50

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

plugins/sudoers/auth/rfc1938.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ sudo_rfc1938_setup(const struct sudoers_context *ctx, struct passwd *pw,
7272
op_len = strlen(orig_prompt);
7373

7474
/* Ignore trailing colon (we will add our own) */
75-
if (orig_prompt[op_len - 1] == ':')
75+
if (op_len > 0 && orig_prompt[op_len - 1] == ':')
7676
op_len--;
7777
else if (op_len >= 2 && orig_prompt[op_len - 1] == ' '
7878
&& orig_prompt[op_len - 2] == ':')

0 commit comments

Comments
 (0)