diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-03-08 11:22:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-08 11:22:07 (GMT) |
commit | 2647afeab694517933c53028d4ad427460b9e1fa (patch) | |
tree | 434da2a4d3743d0ef1769253bd85d033edfde7cc /Python/getargs.c | |
parent | a8a95135a204d6ad5de55b0972ad44bfe9ccf0b2 (diff) | |
download | cpython-2647afeab694517933c53028d4ad427460b9e1fa.zip cpython-2647afeab694517933c53028d4ad427460b9e1fa.tar.gz cpython-2647afeab694517933c53028d4ad427460b9e1fa.tar.bz2 |
[3.12] gh-116447: Fix possible UB in `arraymodule` and `getargs` (GH-116459) (#116496)
gh-116447: Fix possible UB in `arraymodule` and `getargs` (GH-116459)
(cherry picked from commit fdb2d90a274158aee23b526d972172bf41bd4b7e)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Python/getargs.c')
-rw-r--r-- | Python/getargs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index 066739f..5e731cd 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -672,7 +672,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, switch (c) { case 'b': { /* unsigned byte -- very short int */ - char *p = va_arg(*p_va, char *); + unsigned char *p = va_arg(*p_va, unsigned char *); long ival = PyLong_AsLong(arg); if (ival == -1 && PyErr_Occurred()) RETURN_ERR_OCCURRED; @@ -693,7 +693,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, case 'B': {/* byte sized bitfield - both signed and unsigned values allowed */ - char *p = va_arg(*p_va, char *); + unsigned char *p = va_arg(*p_va, unsigned char *); unsigned long ival = PyLong_AsUnsignedLongMask(arg); if (ival == (unsigned long)-1 && PyErr_Occurred()) RETURN_ERR_OCCURRED; |