[Libreoffice-commits] core.git: soltools/cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 4 12:23:45 UTC 2018


 soltools/cpp/_lex.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 22c1d6972b4dbf2a3394a28cacfb27cf5bdbb659
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Oct 4 10:27:54 2018 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Oct 4 14:23:16 2018 +0200

    Avoid -Werror=stringop-truncation
    
    ... "‘strncpy’ output truncated before terminating nul copying as many bytes
    from a string as its length", as reported at
    <https://lists.freedesktop.org/archives/libreoffice/2018-October/081109.html>
    "LO build fails -Werror=stringop-truncation in _lex.c".  Not adding the
    terminating NUL appears to be intentional here, as the s->inp buffer is
    terminated (through s->inl) with EOB bytes after the if/else blocks.
    
    Change-Id: I5a8559e620b7e34ee27cbcd0f836432deb8cba90
    Reviewed-on: https://gerrit.libreoffice.org/61355
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/soltools/cpp/_lex.c b/soltools/cpp/_lex.c
index 3fa180b040a4..70c808b87187 100644
--- a/soltools/cpp/_lex.c
+++ b/soltools/cpp/_lex.c
@@ -668,7 +668,7 @@ Source *
         len = strlen(str);
         s->inb = domalloc(len + 4);
         s->inp = s->inb;
-        strncpy((char *) s->inp, str, len);
+        memcpy((char *) s->inp, str, len);
     }
     else
     {


More information about the Libreoffice-commits mailing list