} 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 {
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);
}
{ \
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) \
p+= 23;
len= strlen(packet->user);
- strncpy(p, packet->user, len);
+ memcpy(p, packet->user, len);
p+= len;
*p++ = '\0';