2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 18:08:23 +00:00

Make a ttydev parse error non-fatal for now

This is new for sudo 1.9.16 so we don't want to break sudo if there
ends up being a bug in formatting dev_t from the front-end.
This commit is contained in:
Todd C. Miller 2024-08-15 09:31:48 -06:00
parent 6a5a8f58e9
commit 4751a4d2dd

View File

@ -469,14 +469,16 @@ sudoers_policy_deserialize_info(struct sudoers_context *ctx, void *v,
long long llval; long long llval;
/* /*
* dev_t is unsigned but sudo_strtonum() deals with signed values. * dev_t can be signed or unsigned. The front-end formats it
* This is not a problem in practice since we allow the full range. * as long long (signed). We allow the full range of values
* which should work with either signed or unsigned dev_t.
*/ */
p = *cur + sizeof("ttydev=") - 1; p = *cur + sizeof("ttydev=") - 1;
llval = sudo_strtonum(p, LLONG_MIN, LLONG_MAX, &errstr); llval = sudo_strtonum(p, LLONG_MIN, LLONG_MAX, &errstr);
if (errstr != NULL) { if (errstr != NULL) {
/* Front end bug? Not a fatal error. */
INVALID("ttydev="); INVALID("ttydev=");
goto bad; continue;
} }
ctx->user.ttydev = (dev_t)llval; ctx->user.ttydev = (dev_t)llval;
continue; continue;