[MERGED] osmo-ggsn[master]: sgsnemu: Make sure buffer has space for terminating-NUL

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Nov 5 19:08:11 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: sgsnemu: Make sure buffer has space for terminating-NUL
......................................................................


sgsnemu: Make sure buffer has space for terminating-NUL

In proc_ipv6_conf_read() we allocatea buffer on the stack but
forgot the terminating NUL byte.

Change-Id: I54126d8bc08c137859f2de4b47ef23fc0714fdd7
Fixes: Coverity CID#178641
---
M sgsnemu/sgsnemu.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index c7ca494..0b0fba6 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -985,7 +985,7 @@
 static char *proc_ipv6_conf_read(const char *dev, const char *file)
 {
 	const char *fmt = "/proc/sys/net/ipv6/conf/%s/%s";
-	char path[strlen(fmt) + strlen(dev) + strlen(file)];
+	char path[strlen(fmt) + strlen(dev) + strlen(file)+1];
 	snprintf(path, sizeof(path), fmt, dev, file);
 	return proc_read(path);
 }

-- 
To view, visit https://gerrit.osmocom.org/4688
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I54126d8bc08c137859f2de4b47ef23fc0714fdd7
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list