]> git.ipfire.org Git - thirdparty/kmod.git/commit
check strtol/strtoul/strtoull results
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 25 May 2025 08:22:09 +0000 (10:22 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 30 May 2025 03:57:51 +0000 (22:57 -0500)
commitdcd652b57c6e60b15cfe8e5791f94e152e08063a
tree3535cadd1b4070c61081d1bed23481f9a58b0c45
parent13b646a73f53716cba3d4a451aec96fbd72d878b
check strtol/strtoul/strtoull results

The strto* family of functions may fail if the input string contains
a number which is too large for the designated data type. In such
cases, errno is set to ERANGE. Check for this error condition and if
subsequent casts would truncate the value.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/357
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-module.c
libkmod/libkmod.c
shared/util.c
testsuite/delete_module.c
testsuite/init_module.c
tools/depmod.c
tools/modprobe.c