Don't call strncpy with mismatching length
authorRicardo Mones <ricardo@mones.org>
Wed, 21 Aug 2019 09:36:40 +0000 (11:36 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Mon, 26 Aug 2019 20:16:00 +0000 (22:16 +0200)
Fixes "vcard.c:238:2: warning: ‘strncpy’ output truncated before
terminating nul copying as many bytes from a string as its length"

src/vcard.c

index 463f4a35da1ee7cb4c2df33c31171ead28b15bc2..2e8fce511c1845509628b5159e570912196cdd8f 100644 (file)
@@ -235,7 +235,7 @@ static gchar *vcard_get_line( VCardFile *cardFile ) {
        start = cardFile->bufptr;
        len = strlen( start );
        end = start + len;
-       strncpy( buf, start, len );
+       memcpy( buf, start, len );
        buf[ len ] = '\0';
        g_strstrip(buf);
        cardFile->bufptr = end + 1;