Commit a56c43b
Explicitly truncate snprintf arguments for GCC 8+
udev-device.c: In function 'udev_device_new_from_devnum':
udev-device.c:100:23: error: '.PCI_ID' directive output may be truncated writing 7 bytes into a region of size between 1 and 32 [-Werror=format-truncation=]
100 | snprintf(buf, 32, "%s.PCI_ID", devbuf);
| ^~~~~~~
udev-device.c:100:2: note: 'snprintf' output between 8 and 39 bytes into a destination of size 32
100 | snprintf(buf, 32, "%s.PCI_ID", devbuf);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
udev-device.c:93:2: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation]
93 | strncpy(devbuf, devpath + 1, 32);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
udev-utils.c: In function 'set_parent':
udev-utils.c:501:34: error: '%s' directive output may be truncated writing up to 79 bytes into a region of size 28 [-Werror=format-truncation=]
501 | snprintf(mib, sizeof(mib), "dev.%s.%s.%%desc", devname, unit);
| ^~ ~~~~~~~
udev-utils.c:501:2: note: 'snprintf' output 12 or more bytes (assuming 91) into a destination of size 32
501 | snprintf(mib, sizeof(mib), "dev.%s.%s.%%desc", devname, unit);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
udev-utils.c:507:34: error: '%s' directive output may be truncated writing up to 79 bytes into a region of size 28 [-Werror=format-truncation=]
507 | snprintf(mib, sizeof(mib), "dev.%s.%s.%%pnpinfo", devname, unit);
| ^~ ~~~~~~~
udev-utils.c:507:2: note: 'snprintf' output 15 or more bytes (assuming 94) into a destination of size 32
507 | snprintf(mib, sizeof(mib), "dev.%s.%s.%%pnpinfo", devname, unit);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
udev-utils.c:512:34: error: '%s' directive output may be truncated writing up to 79 bytes into a region of size 28 [-Werror=format-truncation=]
512 | snprintf(mib, sizeof(mib), "dev.%s.%s.%%parent", devname, unit);
| ^~ ~~~~~~~
udev-utils.c:512:2: note: 'snprintf' output 14 or more bytes (assuming 93) into a destination of size 32
512 | snprintf(mib, sizeof(mib), "dev.%s.%s.%%parent", devname, unit);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1 parent 778cd58 commit a56c43b
2 files changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
515 | | - | |
| 515 | + | |
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
521 | | - | |
| 521 | + | |
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
526 | | - | |
| 526 | + | |
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
| |||
0 commit comments