[MERGED] libosmo-netif[master]: osmux: Fix buffer overflow in osmux_snprintf

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Mon Aug 14 17:15:42 UTC 2017


Pau Espin Pedrol has submitted this change and it was merged.

Change subject: osmux: Fix buffer overflow in osmux_snprintf
......................................................................


osmux: Fix buffer overflow in osmux_snprintf

When running osmux_test on my PC, the process was aborted with a "stack
smashing detected" error.

Change-Id: I8a7cc422c181c0c5712ac8976a5be5f0ad44a9c0
---
M src/osmux.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/src/osmux.c b/src/osmux.c
index 23a6440..2481d6a 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -847,7 +847,7 @@
 }
 
 #define SNPRINTF_BUFFER_SIZE(ret, size, len, offset)	\
-	size += ret;					\
+	size -= ret;					\
 	if (ret > len)					\
 		ret = len;				\
 	offset += ret;					\

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8a7cc422c181c0c5712ac8976a5be5f0ad44a9c0
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list