Skip to content

Commit b3c8708

Browse files
author
git-core
committed
Fix segmentation fault when shell passed via -s doesn't contain /
1 parent 57d607f commit b3c8708

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

su.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ static void allow(char *shell, mode_t mask)
295295
if (!strcmp(shell, "")) {
296296
strcpy(shell , DEFAULT_COMMAND);
297297
}
298-
exe = strrchr (shell, '/') + 1;
298+
exe = strrchr (shell, '/');
299+
exe = (exe) ? exe + 1 : shell;
299300
setresgid(to->uid, to->uid, to->uid);
300301
setresuid(to->uid, to->uid, to->uid);
301302
LOGD("%u %s executing %u %s using shell %s : %s", from->uid, from->bin,

0 commit comments

Comments
 (0)