From: Tomas R. Date: Mon, 16 Dec 2024 16:57:18 +0000 (+0100) Subject: gh-127864: Fix compiler warning (-Wstringop-truncation) (GH-127878) X-Git-Tag: v3.14.0a3~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=081673801e3d47d931d2e2b6a4a1515e1207d938;p=thirdparty%2FPython%2Fcpython.git gh-127864: Fix compiler warning (-Wstringop-truncation) (GH-127878) --- diff --git a/Python/import.c b/Python/import.c index f3511aaf7b80..a9282dde6339 100644 --- a/Python/import.c +++ b/Python/import.c @@ -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; }