diff --git a/src/utmp.c b/src/utmp.c index 3afbcb3fc..c8341cbed 100644 --- 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. */