From: Roy Marples Date: Fri, 16 Aug 2019 21:29:58 +0000 (+0100) Subject: script: Rework assert to pass coverity. X-Git-Tag: v8.0.3~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f2dbbe7e5d27188ebf230d7f8315216a4462b15;p=thirdparty%2Fdhcpcd.git script: Rework assert to pass coverity. It does work differently for non debug builds, but we don't care because we reset the value anyway. This way maybe more descriptive and does avoid a write. --- diff --git a/src/script.c b/src/script.c index 2e9a2f9b..3cb33b6e 100644 --- a/src/script.c +++ b/src/script.c @@ -489,7 +489,7 @@ dumplease: nenv++; } } - assert(*--bufp == '\0'); + assert(*(bufp - 1) == '\0'); if (ctx->script_envlen < nenv) { env = reallocarray(ctx->script_env, nenv + 1, sizeof(*env));