]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix too small sscanf output buffers in kbdmap
authorDimitry Andric <dim@FreeBSD.org>
Sun, 6 Feb 2022 15:25:11 +0000 (16:25 +0100)
committerDimitry Andric <dim@FreeBSD.org>
Wed, 9 Feb 2022 17:26:24 +0000 (18:26 +0100)
commit212c271999d9921ee056e32487d8502df385b0aa
tree66d70289e1145ab45c5e9a8e8994ec8a04d5b1a5
parent50cf1cf36898f8697c32c79e8e7fd279deeee514
Fix too small sscanf output buffers in kbdmap

This fixes the following warnings from clang 14:

usr.sbin/kbdmap/kbdmap.c:241:16: error: 'sscanf' may overflow; destination buffer in argument 5 has size 20, but the corresponding specifier may require size 21 [-Werror,-Wfortify-source]
                            &a, &b, buf);
                                    ^
usr.sbin/kbdmap/kbdmap.c:615:8: error: 'sscanf' may overflow; destination buffer in argument 3 has size 64, but the corresponding specifier may require size 65 [-Werror,-Wfortify-source]
                            keym, lng, desc);
                            ^
usr.sbin/kbdmap/kbdmap.c:615:14: error: 'sscanf' may overflow; destination buffer in argument 4 has size 64, but the corresponding specifier may require size 65 [-Werror,-Wfortify-source]
                            keym, lng, desc);
                                  ^
usr.sbin/kbdmap/kbdmap.c:615:19: error: 'sscanf' may overflow; destination buffer in argument 5 has size 256, but the corresponding specifier may require size 257 [-Werror,-Wfortify-source]
                            keym, lng, desc);
                                       ^

In each case, the buffer being sscanf'd into is one byte too small.

MFC after:  3 days

(cherry picked from commit e17fede8ff4629b5ff640ed660940b04c70da0b6)
usr.sbin/kbdmap/kbdmap.c