summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/phar/tar.c6
-rw-r--r--ext/phar/zip.c6
-rw-r--r--ext/standard/crypt.c2
3 files changed, 7 insertions, 7 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(&central, 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;
}
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index d0b1e6a5a7..b727575fad 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -255,7 +255,7 @@ PHP_FUNCTION(crypt)
/* The automatic salt generation covers standard DES, md5-crypt and Blowfish (simple) */
if (!*salt) {
- strncpy(salt, "$1$", 3);
+ memcpy(salt, "$1$", 3);
php_random_bytes_throw(&salt[3], 8);
php_to64(&salt[3], 8);
strncpy(&salt[11], "$", PHP_MAX_SALT_LEN - 11);