[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PULL 01/54] pc-bios/s390-ccw: Clean up harmless misuse of
From: |
Cornelia Huck |
Subject: |
[qemu-s390x] [PULL 01/54] pc-bios/s390-ccw: Clean up harmless misuse of isdigit() |
Date: |
Mon, 20 May 2019 19:02:09 +0200 |
From: Markus Armbruster <address@hidden>
atoui() and get_index() pass char values to isdigit(). With a
standard isdigit(), we'd get undefined behavior when the value is
negative. Can't happen as char is unsigned on s390x. Even if it
ould, we're actually using isdigit() from pc-bios/s390-ccw/libc.h
here, which works fine for negative values. Clean up anyway, just
to avoid setting a bad example.
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
[thuth: updated the commit message]
Signed-off-by: Thomas Huth <address@hidden>
---
pc-bios/s390-ccw/libc.c | 2 +-
pc-bios/s390-ccw/menu.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pc-bios/s390-ccw/libc.c b/pc-bios/s390-ccw/libc.c
index a786566c4c7b..3187923950e2 100644
--- a/pc-bios/s390-ccw/libc.c
+++ b/pc-bios/s390-ccw/libc.c
@@ -38,7 +38,7 @@ uint64_t atoui(const char *str)
}
while (*str) {
- if (!isdigit(*str)) {
+ if (!isdigit(*(unsigned char *)str)) {
break;
}
val = val * 10 + *str - '0';
diff --git a/pc-bios/s390-ccw/menu.c b/pc-bios/s390-ccw/menu.c
index 82a4ae631597..ce3815b2010d 100644
--- a/pc-bios/s390-ccw/menu.c
+++ b/pc-bios/s390-ccw/menu.c
@@ -134,7 +134,7 @@ static int get_index(void)
/* Check for erroneous input */
for (i = 0; i < len; i++) {
- if (!isdigit(buf[i])) {
+ if (!isdigit((unsigned char)buf[i])) {
return -1;
}
}
--
2.20.1
- [qemu-s390x] [PULL 00/54] s390x update, Cornelia Huck, 2019/05/20
- [qemu-s390x] [PULL 01/54] pc-bios/s390-ccw: Clean up harmless misuse of isdigit(),
Cornelia Huck <=
- [qemu-s390x] [PULL 02/54] s390-bios: Skip bootmap signature entries, Cornelia Huck, 2019/05/20
- [qemu-s390x] [PULL 04/54] s390/ipl: cast to SCSIDevice directly, Cornelia Huck, 2019/05/20
- [qemu-s390x] [PULL 05/54] s390/css: handle CCW_FLAG_SKIP, Cornelia Huck, 2019/05/20
- [qemu-s390x] [PULL 03/54] pc-bios/s390: Update firmware image with "Skip bootmap signature entries" fix, Cornelia Huck, 2019/05/20
- [qemu-s390x] [PULL 06/54] s390x/tcg: Implement VECTOR ADD, Cornelia Huck, 2019/05/20
- [qemu-s390x] [PULL 07/54] s390x/tcg: Implement VECTOR ADD COMPUTE CARRY, Cornelia Huck, 2019/05/20
- [qemu-s390x] [PULL 09/54] s390x/tcg: Implement VECTOR ADD WITH CARRY COMPUTE CARRY, Cornelia Huck, 2019/05/20
- [qemu-s390x] [PULL 08/54] s390x/tcg: Implement VECTOR ADD WITH CARRY, Cornelia Huck, 2019/05/20
- [qemu-s390x] [PULL 10/54] s390x/tcg: Implement VECTOR AND (WITH COMPLEMENT), Cornelia Huck, 2019/05/20
- [qemu-s390x] [PULL 11/54] s390x/tcg: Implement VECTOR AVERAGE, Cornelia Huck, 2019/05/20