changeset 5348:5d4210eb0187 draft

dhcpcd: Ensure dump is terminated
author Roy Marples <roy@marples.name>
date Wed, 10 Jun 2020 14:38:46 +0100
parents fabb85fb8e37
children a399aaae6092
files src/dhcpcd.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/dhcpcd.c	Wed Jun 10 14:31:03 2020 +0100
+++ b/src/dhcpcd.c	Wed Jun 10 14:38:46 2020 +0100
@@ -1659,6 +1659,8 @@
 		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) {