Skip to content

Commit

Permalink
Make a ttydev parse error non-fatal for now
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
millert committed Aug 15, 2024
1 parent 6a5a8f5 commit 4751a4d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugins/sudoers/policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4751a4d

Please sign in to comment.