]> git.ipfire.org Git - thirdparty/kmod.git/commit
depmod: shut up gcc insufficinet buffer warning
authorMichal Suchanek <msuchanek@suse.de>
Mon, 10 Dec 2018 21:29:34 +0000 (22:29 +0100)
committerLucas De Marchi <lucas.demarchi@intel.com>
Mon, 17 Dec 2018 23:31:55 +0000 (15:31 -0800)
commit4a894aeaebf69166e6344d8a82c2600a1d4c0d08
treeb007e68882dc24521da13b1bcc5c3feefaa39ee2
parenta06bacf500d56b72b5f9b121ebf7f6af9e3df185
depmod: shut up gcc insufficinet buffer warning

In a couple of places depmod concatenates the module directory and filename
with snprintf. This can technically overflow creating an unterminated string if
module directory name is long. Use openat instead as is done elsewhere in
depmod. This avoids the snprintf, the extra buffer on stack, and the gcc
warning. It may even fix a corner case when the module direcotry name is just
under PATH_MAX.

[ Lucas: fix up coding style and closing fd on error path ]

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
tools/depmod.c