mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-127864: Fix compiler warning (-Wstringop-truncation) (GH-127878)
This commit is contained in:
parent
52d552cda7
commit
081673801e
1 changed files with 3 additions and 2 deletions
|
@ -1176,9 +1176,10 @@ hashtable_key_from_2_strings(PyObject *str1, PyObject *str2, const char sep)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
strncpy(key, str1_data, str1_len);
|
||||
memcpy(key, str1_data, str1_len);
|
||||
key[str1_len] = sep;
|
||||
strncpy(key + str1_len + 1, str2_data, str2_len + 1);
|
||||
memcpy(key + str1_len + 1, str2_data, str2_len);
|
||||
key[size - 1] = '\0';
|
||||
assert(strlen(key) == size - 1);
|
||||
return key;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue