HomeFreeBSD

Fix too small sscanf output buffers in kbdmap

Description

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)

Details

Provenance
dimAuthored on Feb 6 2022, 3:25 PM
Parents
rG4eebfbf0740c: Fix too small hostname buffer in bootparamd
Branches
Unknown
Tags
Unknown