diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2021-07-24 11:31:07 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-07-30 01:41:13 +0000 |
commit | 7318d393eafef5eaecffb74214767c0b15261b0b (patch) | |
tree | 5d358f8c012b480f79f718ed6e1e7dcc7793285b /firmware/libc/atoi.c | |
parent | 2e9443104fbc4a83e130c44b2e8702d0dda1bd82 (diff) | |
download | rockbox-7318d393eafef5eaecffb74214767c0b15261b0b.tar.gz rockbox-7318d393eafef5eaecffb74214767c0b15261b0b.zip |
libc: atoi() is supposed to return 0 if handed a NULL pointer
Change-Id: I2d77532536ca83e5c9c2d7622a0e672082969f75
Diffstat (limited to 'firmware/libc/atoi.c')
-rw-r--r-- | firmware/libc/atoi.c | 5 |
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) | |||
26 | { | 26 | { |
27 | int value = 0; | 27 | int value = 0; |
28 | int sign = 1; | 28 | int sign = 1; |
29 | 29 | ||
30 | if (!str) | ||
31 | return 0; | ||
32 | |||
30 | while (isspace(*str)) | 33 | while (isspace(*str)) |
31 | { | 34 | { |
32 | str++; | 35 | str++; |