diff options
author | Remi Collet <remi@remirepo.net> | 2019-07-24 16:06:07 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2019-07-25 11:50:44 +0200 |
commit | 946a1e43149e95969caf721b2fbc1bbffc3c478c (patch) | |
tree | eef601de0a448cb9e347690c4ee40d51d265464f /ext/phar | |
parent | 1cbcf0f4f1e9a14b3fc76f6d3e53b567a9464fd4 (diff) | |
download | php-git-946a1e43149e95969caf721b2fbc1bbffc3c478c.tar.gz |
Fix build warnings
- switch from strncpy to memcpy for -Wstringop-truncation
Diffstat (limited to 'ext/phar')
-rw-r--r-- | ext/phar/tar.c | 6 | ||||
-rw-r--r-- | ext/phar/zip.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 8db89e1936..d1b19ee586 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -772,9 +772,9 @@ static int phar_tar_writeheaders_int(phar_entry_info *entry, void *argument) /* } } - strncpy(header.magic, "ustar", sizeof("ustar")-1); - strncpy(header.version, "00", sizeof("00")-1); - strncpy(header.checksum, " ", sizeof(" ")-1); + memcpy(header.magic, "ustar", sizeof("ustar")-1); + memcpy(header.version, "00", sizeof("00")-1); + memcpy(header.checksum, " ", sizeof(" ")-1); entry->crc32 = phar_tar_checksum((char *)&header, sizeof(header)); if (FAILURE == phar_tar_octal(header.checksum, entry->crc32, sizeof(header.checksum)-1)) { diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 3d2256536d..e086354b11 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -821,8 +821,8 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg) /* {{{ memset(&local, 0, sizeof(local)); memset(¢ral, 0, sizeof(central)); memset(&perms, 0, sizeof(perms)); - strncpy(local.signature, "PK\3\4", 4); - strncpy(central.signature, "PK\1\2", 4); + memcpy(local.signature, "PK\3\4", 4); + memcpy(central.signature, "PK\1\2", 4); PHAR_SET_16(central.extra_len, sizeof(perms)); PHAR_SET_16(local.extra_len, sizeof(perms)); perms.tag[0] = 'n'; @@ -1409,7 +1409,7 @@ fperror: pass.free_fp = pass.free_ufp = 1; memset(&eocd, 0, sizeof(eocd)); - strncpy(eocd.signature, "PK\5\6", 4); + memcpy(eocd.signature, "PK\5\6", 4); if (!phar->is_data && !phar->sig_flags) { phar->sig_flags = PHAR_SIG_SHA1; } |