Change in osmocom-bb[master]: layer23: Fix compiler warning about snprintf buffer too small

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
Sat Aug 11 12:59:31 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10433 )

Change subject: layer23: Fix compiler warning about snprintf buffer too small
......................................................................

layer23: Fix compiler warning about snprintf buffer too small

gsm322.c:366:22: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
  sprintf(string, "-%d", 110 - rxlev);
                      ^
gsm322.c:366:2: note: ‘sprintf’ output between 3 and 6 bytes into a destination of size 5
  sprintf(string, "-%d", 110 - rxlev);

Change-Id: I7b19fef89ba0cb0c1edbdd62c46ad8395e44145b
---
M src/host/layer23/src/mobile/gsm322.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/host/layer23/src/mobile/gsm322.c b/src/host/layer23/src/mobile/gsm322.c
index 3bc8b5c..a2cbb86 100644
--- a/src/host/layer23/src/mobile/gsm322.c
+++ b/src/host/layer23/src/mobile/gsm322.c
@@ -358,7 +358,7 @@
 
 char *gsm_print_rxlev(uint8_t rxlev)
 {
-	static char string[5];
+	static char string[6];
 	if (rxlev == 0)
 		return "<=-110";
 	if (rxlev >= 63)

-- 
To view, visit https://gerrit.osmocom.org/10433
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I7b19fef89ba0cb0c1edbdd62c46ad8395e44145b
Gerrit-Change-Number: 10433
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180811/92520005/attachment.htm>


More information about the gerrit-log mailing list