summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2021-07-24 11:31:07 -0400
committerSolomon Peachy <pizza@shaftnet.org>2021-07-30 01:41:13 +0000
commit7318d393eafef5eaecffb74214767c0b15261b0b (patch)
tree5d358f8c012b480f79f718ed6e1e7dcc7793285b
parent2e9443104fbc4a83e130c44b2e8702d0dda1bd82 (diff)
downloadrockbox-7318d393eafef5eaecffb74214767c0b15261b0b.tar.gz
rockbox-7318d393eafef5eaecffb74214767c0b15261b0b.tar.bz2
rockbox-7318d393eafef5eaecffb74214767c0b15261b0b.zip
libc: atoi() is supposed to return 0 if handed a NULL pointer
Change-Id: I2d77532536ca83e5c9c2d7622a0e672082969f75
-rw-r--r--firmware/libc/atoi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/firmware/libc/atoi.c b/firmware/libc/atoi.c
index 3393839b27..00617c3d13 100644
--- a/firmware/libc/atoi.c
+++ b/firmware/libc/atoi.c
@@ -26,7 +26,10 @@ int atoi (const char *str)
{
int value = 0;
int sign = 1;
-
+
+ if (!str)
+ return 0;
+
while (isspace(*str))
{
str++;