Review at  https://gerrit.osmocom.org/3521

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(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/21/3521/1

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: newchange
Gerrit-Change-Id: I8a7cc422c181c0c5712ac8976a5be5f0ad44a9c0
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <[email protected]>

Reply via email to