arm-trusted-firmware/lib/libc
Andre Przywara b30dd4030d fix(libc): limit snprintf radix value
In our unsigned_num_print() function we first print the integer into a
local buffer, then put this through alignment and padding and output the
result. For this we use a local buffer, sized by the maximum possible
length of the largest possible number.

However this assumes that the radix is not smaller than 10, which is
indeed the smallest value we pass into this static function at the
moment. To prevent accidents in the future, should we add support for
other radices, add an assert to enforce our assumption.

Unfortunately this cannot be a static assert (CASSERT), since the
compiler is not smart enough to see that the argument is always coming
from a literal.

Change-Id: Ic204462600d9f4c281d899cf9f2c698a0a33a874
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2022-02-10 16:33:32 +00:00
..
aarch32 plat/arm: Introduce and use libc_asm.mk makefile 2020-09-02 16:21:34 +00:00
aarch64 plat/arm: Introduce and use libc_asm.mk makefile 2020-09-02 16:21:34 +00:00
abort.c Sanitise includes across codebase 2019-01-04 10:43:17 +00:00
assert.c Don't return error information from console_flush 2020-10-09 10:21:50 -05:00
exit.c libc: Fix some MISRA defects 2018-08-30 16:21:59 +01:00
libc.mk libc: Import strtoull from FreeBSD project 2021-02-03 10:36:33 -06:00
libc_asm.mk libc: Import strtoull from FreeBSD project 2021-02-03 10:36:33 -06:00
memchr.c libc: fix memchr implementation 2019-06-20 09:59:24 +01:00
memcmp.c Remove several warnings reported with W=1 2019-04-01 10:43:42 +01:00
memcpy.c Remove several warnings reported with W=1 2019-04-01 10:43:42 +01:00
memmove.c libc: Cleanup remaining files 2018-08-22 10:26:04 +01:00
memrchr.c libc: add memrchr 2019-12-11 08:51:26 +01:00
memset.c libc: memset: Fix MISRA issues 2021-02-24 09:33:59 +00:00
printf.c libc/printf: add support to print "%" character 2021-01-20 13:09:13 +08:00
putchar.c Sanitise includes across codebase 2019-01-04 10:43:17 +00:00
puts.c libc: Fix some MISRA defects 2018-08-30 16:21:59 +01:00
snprintf.c fix(libc): limit snprintf radix value 2022-02-10 16:33:32 +00:00
strchr.c libc: Cleanup FreeBSD files 2018-08-22 10:26:05 +01:00
strcmp.c libc: Cleanup FreeBSD files 2018-08-22 10:26:05 +01:00
strlcat.c libc: Import strlcat from FreeBSD project 2020-09-09 13:48:04 -05:00
strlcpy.c libc: Adapt strlcpy to this codebase 2018-11-02 13:41:33 +00:00
strlen.c libc: Introduce cdefs.h, assert.h and strlen.c 2018-08-22 10:26:04 +01:00
strncmp.c libc: Cleanup FreeBSD files 2018-08-22 10:26:05 +01:00
strnlen.c libc: Cleanup FreeBSD files 2018-08-22 10:26:05 +01:00
strrchr.c libc: Integrate strrchr in libc 2018-10-23 18:27:45 +01:00
strtok.c libc: Import strtok_r from FreeBSD project 2020-09-18 11:58:41 -05:00
strtol.c libc: Import strtol from FreeBSD project 2021-02-03 10:36:33 -06:00
strtoll.c libc: Import strtoll from FreeBSD project 2021-02-03 10:36:33 -06:00
strtoul.c libc: Import strtoul from FreeBSD project 2021-02-03 10:36:33 -06:00
strtoull.c libc: Import strtoull from FreeBSD project 2021-02-03 10:36:33 -06:00