projects
/
sudo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aa200cd
)
Disable stringop-truncation false positive warnings on gcc 8.
author
Todd C. Miller
<Todd.Miller@sudo.ws>
Tue, 30 Jul 2019 18:42:07 +0000
(12:42 -0600)
committer
Todd C. Miller
<Todd.Miller@sudo.ws>
Tue, 30 Jul 2019 18:42:07 +0000
(12:42 -0600)
Strings in struct utmp/utmpx are not guaranteed to be NUL-terminated.
src/utmp.c
patch
|
blob
|
history
diff --git
a/src/utmp.c
b/src/utmp.c
index 3afbcb3fcff2d9506e65d9a64e0a411e73bbd7ae..c8341cbed98d88a58f30f7f84008ac8699646c7c 100644
(file)
--- a/
src/utmp.c
+++ b/
src/utmp.c
@@
-52,6
+52,14
@@
#include "sudo.h"
#include "sudo_exec.h"
+/*
+ * GCC 8 warns about strncpy() where the size field is the size of the buffer.
+ * However, strings in utmp may not be NUL terminated so this usage is correct.
+ */
+#if __GNUC_PREREQ__(8, 0)
+# pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
+
/*
* Simplify handling of different utmp types.
*/