]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
script: Rework assert to pass coverity.
authorRoy Marples <roy@marples.name>
Fri, 16 Aug 2019 21:29:58 +0000 (22:29 +0100)
committerRoy Marples <roy@marples.name>
Fri, 16 Aug 2019 21:29:58 +0000 (22:29 +0100)
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.

src/script.c

index 2e9a2f9b37e3128c88263fb0a9771edaee7273b5..3cb33b6e709b3351a21d058c35aa52074065b333 100644 (file)
@@ -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));