]> git.ipfire.org Git - thirdparty/kmod.git/commit
libkmod: Improve signature parser on 32 bit archs
authorTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 3 Sep 2024 17:49:04 +0000 (19:49 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 6 Sep 2024 15:42:48 +0000 (10:42 -0500)
commitac34d1897282cf764296e085d26100788fd5a0e2
tree31f0a01d6e40b022d907f95c539862e9405c3af4
parent18c49d0598afe87796e3b9981df4ff9e94308f62
libkmod: Improve signature parser on 32 bit archs

During signature parser validation it is not enough to cast the end
result to 64 bit, because on 32 bit systems size_t is an unsigned 32 bit
integer, which implies that this will be the data type used to evaluate
the expression BEFORE casting it due to C standard.

Since the unsigned 32 bit calculation can overflow, cast the size_t
to int64_t, which makes the whole calculation safe.

This has no negative impact on 64 bit systems because the size_t
value is read as an unsigned 32 bit value from module.

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/95
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-signature.c