]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
dhcpcd: Ensure dump is terminated
authorRoy Marples <roy@marples.name>
Wed, 10 Jun 2020 13:38:46 +0000 (14:38 +0100)
committerRoy Marples <roy@marples.name>
Wed, 10 Jun 2020 13:38:46 +0000 (14:38 +0100)
src/dhcpcd.c

index dc21583bf006aecee45ee36a803ff73c6b089405..e030ff386aab567f3f50a4a15fc3eeb26f00b8f3 100644 (file)
@@ -1659,6 +1659,8 @@ dhcpcd_readdump2(void *arg)
                return;
        }
 
+       if (ctx->ctl_buf[ctx->ctl_buflen - 1] != '\0') /* unlikely */
+               ctx->ctl_buf[ctx->ctl_buflen - 1] = '\0';
        script_dump(ctx->ctl_buf, ctx->ctl_buflen);
        fflush(stdout);
        if (--ctx->ctl_extra != 0) {