From 4751a4d2dd09b94e438208439902b36aec79767e Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 15 Aug 2024 09:31:48 -0600 Subject: [PATCH] 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. --- plugins/sudoers/policy.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/sudoers/policy.c b/plugins/sudoers/policy.c index 5a1d1c73a..20f67a1c6 100644 --- a/plugins/sudoers/policy.c +++ b/plugins/sudoers/policy.c @@ -469,14 +469,16 @@ sudoers_policy_deserialize_info(struct sudoers_context *ctx, void *v, long long llval; /* - * dev_t is unsigned but sudo_strtonum() deals with signed values. - * This is not a problem in practice since we allow the full range. + * dev_t can be signed or unsigned. The front-end formats it + * 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; llval = sudo_strtonum(p, LLONG_MIN, LLONG_MAX, &errstr); if (errstr != NULL) { + /* Front end bug? Not a fatal error. */ INVALID("ttydev="); - goto bad; + continue; } ctx->user.ttydev = (dev_t)llval; continue;