From 73b0ac4bc13af0072c67a6264725c55983e223ea Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 16 Jul 2016 20:54:07 -0600 Subject: [PATCH] Fix underflow checl in fill_args(). --- plugins/sudoers/toke_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/sudoers/toke_util.c b/plugins/sudoers/toke_util.c index 727ffd33e..2c2273ea8 100644 --- a/plugins/sudoers/toke_util.c +++ b/plugins/sudoers/toke_util.c @@ -153,7 +153,8 @@ fill_args(const char *s, size_t len, int addspace) p = sudoerslval.command.args + arg_len; if (addspace) *p++ = ' '; - if (strlcpy(p, s, arg_size - (p - sudoerslval.command.args)) != (size_t)len) { + len = arg_size - (p - sudoerslval.command.args); + if (strlcpy(p, s, len) != len) { sudo_warnx(U_("internal error, %s overflow"), __func__); goto bad; } -- 2.49.0