summaryrefslogtreecommitdiff
path: root/ext/mysqlnd
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2008-01-08 13:11:55 +0000
committerAndrey Hristov <andrey@php.net>2008-01-08 13:11:55 +0000
commit82e36686b3e23d43697dc1dbd7c5960933982440 (patch)
treec34887af05404b126f4b556eb46e94208ce53fbe /ext/mysqlnd
parentb0b510f6e6c36d0067a5d34d5f254ab734a0f025 (diff)
downloadphp-git-82e36686b3e23d43697dc1dbd7c5960933982440.tar.gz
strncpy->strlcpy
Diffstat (limited to 'ext/mysqlnd')
-rw-r--r--ext/mysqlnd/mysqlnd.c4
-rw-r--r--ext/mysqlnd/mysqlnd_loaddata.c2
-rw-r--r--ext/mysqlnd/mysqlnd_priv.h2
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.c2
4 files changed, 5 insertions, 5 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index a0a13208b9..2ee2244b18 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -676,14 +676,14 @@ PHPAPI MYSQLND *mysqlnd_connect(MYSQLND *conn,
} else if (ok_packet.field_count == 0xFF) {
if (ok_packet.sqlstate[0]) {
if (!self_alloced) {
- strncpy(conn->error_info.sqlstate, ok_packet.sqlstate, sizeof(conn->error_info.sqlstate));
+ strlcpy(conn->error_info.sqlstate, ok_packet.sqlstate, sizeof(conn->error_info.sqlstate));
}
DBG_ERR_FMT("ERROR:%d [SQLSTATE:%s] %s",
ok_packet.error_no, ok_packet.sqlstate, ok_packet.error);
}
if (!self_alloced) {
conn->error_info.error_no = ok_packet.error_no;
- strncpy(conn->error_info.error, ok_packet.error, sizeof(conn->error_info.error));
+ strlcpy(conn->error_info.error, ok_packet.error, sizeof(conn->error_info.error));
}
}
} else {
diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c
index 5e4b508629..02166ca210 100644
--- a/ext/mysqlnd/mysqlnd_loaddata.c
+++ b/ext/mysqlnd/mysqlnd_loaddata.c
@@ -113,7 +113,7 @@ int mysqlnd_local_infile_error(void *ptr, char *error_buf, uint error_buf_len TS
DBG_ENTER("mysqlnd_local_infile_error");
if (info) {
- strncpy(error_buf, info->error_msg, error_buf_len);
+ strlcpy(error_buf, info->error_msg, error_buf_len);
DBG_INF_FMT("have info, %d", info->error_no);
DBG_RETURN(info->error_no);
}
diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h
index 3a206cb39c..cf6424e49f 100644
--- a/ext/mysqlnd/mysqlnd_priv.h
+++ b/ext/mysqlnd/mysqlnd_priv.h
@@ -143,7 +143,7 @@
{ \
error_info.error_no = 0; \
error_info.error[0] = '\0'; \
- strncpy(error_info.sqlstate, "00000", sizeof("00000") - 1); \
+ strlcpy(error_info.sqlstate, "00000", sizeof(error_info.sqlstate)); \
}
#define SET_CLIENT_ERROR(error_info, a, b, c) \
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
index 8c119a769f..5f1ee54b88 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@ -698,7 +698,7 @@ size_t php_mysqlnd_auth_write(void *_packet, MYSQLND *conn TSRMLS_DC)
p+= 23;
len= strlen(packet->user);
- strncpy(p, packet->user, len);
+ memcpy(p, packet->user, len);
p+= len;
*p++ = '\0';