• Emmanuele Bassi's avatar
    Terminate strncpy() buffers correctly · 8f8b68f8
    Emmanuele Bassi authored
    When using strncpy() with a buffer we need to account for the
    terminating NUL character. GCC 8 started warning when using PPD_MAX_NAME
    as the buffer length for strncpy() because the buffer we're copying into
    has the same length — which means that the terminating NUL may be
    skipped if the source string has a length of PPD_MAX_NAME.
    
    The appropriate way to handle the case where we're copying a source with
    a length bigger than of PPD_MAX_NAME is, as reported in the strncpy()
    documentation, to copy `PPD_MAX_NAME - 1` bytes, and explicitly NUL
    terminate the destination buffer. This has the additional benefit of
    avoiding the compiler warning.
    8f8b68f8
Name
Last commit
Last update
.gitlab-ci Loading commit data...
build Loading commit data...
build-aux/flatpak Loading commit data...
demos Loading commit data...
docs Loading commit data...
examples Loading commit data...
gdk Loading commit data...
gtk Loading commit data...
libgail-util Loading commit data...
m4 Loading commit data...
m4macros Loading commit data...
modules Loading commit data...
po Loading commit data...
po-properties Loading commit data...
tests Loading commit data...
testsuite Loading commit data...
.gitlab-ci.yml Loading commit data...
AUTHORS Loading commit data...
COPYING Loading commit data...
HACKING Loading commit data...
INSTALL.in Loading commit data...
MAINTAINERS Loading commit data...
Makefile.am Loading commit data...
Makefile.decl Loading commit data...
NEWS Loading commit data...
NEWS.pre-1-0 Loading commit data...
README.commits Loading commit data...
README.in Loading commit data...
README.win32 Loading commit data...
acinclude.m4 Loading commit data...
autogen.sh Loading commit data...
config.h.win32.in Loading commit data...
configure.ac Loading commit data...
gail-3.0.pc.in Loading commit data...
gdk-3.0.pc.in Loading commit data...
git.mk Loading commit data...
gtk+-3.0.pc.in Loading commit data...
gtk+-unix-print-3.0.pc.in Loading commit data...
gtk+.doap Loading commit data...
gtk-zip.sh.in Loading commit data...
make-pot Loading commit data...
makefile.msc Loading commit data...
sanitize-la.sh Loading commit data...