Fix compilation warning for 'strncpy' due string truncation

As per the GCC manual, calls to 'strn*' function family shall be
replaced by 'memcpy' when truncation (no null termination) is expected.
pull/5180/head
Javier Jaramago Fernández 6 months ago
parent 639f9d0c74
commit 67624b8569

@ -8145,8 +8145,8 @@ char* MySQL_Session::get_current_query(int max_length) {
res = (char *) malloc(query_len + 1);
if (trunc_query) {
// for truncated queries, add three dots at the end
strncpy(res, query_ptr, query_len - 3);
strncpy(res + (query_len - 3), "...", 3);
memcpy(res, query_ptr, query_len - 3);
memcpy(res + (query_len - 3), "...", 3);
} else {
strncpy(res, query_ptr, query_len);
}

Loading…
Cancel
Save