https://github.com/python/cpython/commit/081673801e3d47d931d2e2b6a4a1515e1207d938
commit: 081673801e3d47d931d2e2b6a4a1515e1207d938
branch: main
author: Tomas R. <[email protected]>
committer: colesbury <[email protected]>
date: 2024-12-16T11:57:18-05:00
summary:
gh-127864: Fix compiler warning (-Wstringop-truncation) (GH-127878)
files:
M Python/import.c
diff --git a/Python/import.c b/Python/import.c
index f3511aaf7b8010..a9282dde633959 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;
}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]