mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-21 17:37:16 +00:00
digest_matches: plug fd leak on snprinf() failure
This commit is contained in:
parent
55d3c99c4e
commit
26a1a7529a
@ -272,7 +272,8 @@ command_matches_dir(struct sudoers_context *ctx, const char *sudoers_dir,
|
||||
len = snprintf(sdbuf, sizeof(sdbuf), "%s%s", runchroot, sudoers_dir);
|
||||
if (len >= ssizeof(sdbuf)) {
|
||||
errno = ENAMETOOLONG;
|
||||
debug_return_bool(false);
|
||||
sudo_warn("%s%s", runchroot, sudoers_dir);
|
||||
goto done;
|
||||
}
|
||||
sudoers_dir = sdbuf;
|
||||
chrootlen = strlen(runchroot);
|
||||
@ -536,7 +537,8 @@ command_matches_glob(struct sudoers_context *ctx, const char *sudoers_cmnd,
|
||||
snprintf(pathbuf, sizeof(pathbuf), "%s%s", runchroot, sudoers_cmnd);
|
||||
if (len >= ssizeof(pathbuf)) {
|
||||
errno = ENAMETOOLONG;
|
||||
debug_return_bool(false);
|
||||
sudo_warn("%s%s", runchroot, sudoers_cmnd);
|
||||
debug_return_int(DENY);
|
||||
}
|
||||
sudoers_cmnd = pathbuf;
|
||||
chrootlen = strlen(runchroot);
|
||||
|
@ -73,7 +73,8 @@ digest_matches(int fd, const char *path, const char *runchroot,
|
||||
snprintf(pathbuf, sizeof(pathbuf), "%s%s", runchroot, path);
|
||||
if (len >= ssizeof(pathbuf)) {
|
||||
errno = ENAMETOOLONG;
|
||||
debug_return_bool(false);
|
||||
sudo_warn("%s%s", runchroot, path);
|
||||
goto done;
|
||||
}
|
||||
path = pathbuf;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user