Change in libosmocore[master]: fix isdigit taking unsigned as input

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

Kévin Redon gerrit-no-reply at lists.osmocom.org
Thu May 23 17:01:59 UTC 2019


Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/14149


Change subject: fix isdigit taking unsigned as input
......................................................................

fix isdigit taking unsigned as input

fixes the following error warnings when cross-compiling using:
./configure --enable-static --prefix=/usr/local/arm-none-eabi --host=arm-none-eabi --enable-embedded --disable-doxygen --disable-shared --disable-pseudotalloc --enable-external-tests CFLAGS="-Os -ffunction-sections -fdata-sections -nostartfiles -nodefaultlibs -Werror -Wno-error=deprecated -Wno-error=deprecated-declarations -Wno-error=cpp -mthumb -Os -mlong-calls -g3 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -Wno-error=format"

utils.c:1002:18: error: array subscript has type 'char' [-Werror=char-subscripts]
 1002 |   if (!isdigit(in[i]))

gsm23003.c:414:34: error: array subscript has type 'char' [-Werror=char-subscripts]
  414 |  if (!mnc_str || !isdigit(mnc_str[0]) || strlen(mnc_str) > 3)

Change-Id: Ia13fd5ee79fc6dc3291c0b99958ab3c01afee17d
---
M src/gsm/gsm23003.c
M src/utils.c
2 files changed, 2 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/49/14149/1

diff --git a/src/gsm/gsm23003.c b/src/gsm/gsm23003.c
index a97ed07..584654b 100644
--- a/src/gsm/gsm23003.c
+++ b/src/gsm/gsm23003.c
@@ -411,7 +411,7 @@
 	char *endptr;
 	int rc = 0;
 
-	if (!mnc_str || !isdigit(mnc_str[0]) || strlen(mnc_str) > 3)
+	if (!mnc_str || !isdigit((unsigned char)mnc_str[0]) || strlen(mnc_str) > 3)
 		return -EINVAL;
 
 	errno = 0;
diff --git a/src/utils.c b/src/utils.c
index 59dc816..6b871c8 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -999,7 +999,7 @@
 
 	/* All input must be numbers */
 	for (i = 0; i < in_len; i++) {
-		if (!isdigit(in[i]))
+		if (!isdigit((unsigned char)in[i]))
 			return -EINVAL;
 	}
 

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia13fd5ee79fc6dc3291c0b99958ab3c01afee17d
Gerrit-Change-Number: 14149
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190523/6fd6b110/attachment.htm>


More information about the gerrit-log mailing list