1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
Description: Fix GCC-10 ftbfs when used with -Werror=format-overflow=
Process names have a maximum length of 16 bytes and the buffer used has a
length of 16 bytes, but the compiler is picky about writing and arbirary
string into that small buffer. Tell the compiler to write max. 15 chars +
'\0', to make it happy.
https://stackoverflow.com/questions/23534263/what-is-the-maximum-allowed-limit-on-the-length-of-a-process-name
.
procenv (0.50-1ubuntu3) groovy; urgency=medium
.
* Fix GCC-10 ftbfs, by telling the compiler the max length to be written.
(Closes: #966883) (LP: #1889138)
Author: Lukas Märdian <lukas.maerdian@canonical.com>
Bug: https://github.com/jamesodhunt/procenv/issues/15
Bug-Debian: https://bugs.debian.org/966883
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1889138
---
--- procenv-0.50.orig/src/platform/linux/platform.c
+++ procenv-0.50/src/platform/linux/platform.c
@@ -1263,12 +1263,12 @@ handle_proc_branch_linux (void)
if ((p=strstr (buffer, "Name:")) == buffer) {
p += 1+strlen ("Name:"); /* jump over tab char */
- sprintf (name, "%s", p);
+ sprintf (name, "%.15s", p);
}
if ((p=strstr (buffer, "PPid:")) == buffer) {
p += 1+strlen ("PPid:"); /* jump over tab char */
- sprintf (ppid, "%s", p);
+ sprintf (ppid, "%.15s", p);
/* got all we need now */
break;
|