diff options
author | Andreas Schneider <asn@samba.org> | 2015-12-10 17:35:51 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2015-12-10 23:49:22 +0100 |
commit | 7505e1c7f93fae556bb92b19922791bc703b6be1 (patch) | |
tree | ca04a782fdfacf84f26a225cdc2a377526e4e57e | |
parent | 59ecbfa4fb64785c24fe3ce4bfa96a23f804eac3 (diff) | |
download | pam_wrapper-7505e1c7f93fae556bb92b19922791bc703b6be1.tar.gz pam_wrapper-7505e1c7f93fae556bb92b19922791bc703b6be1.tar.xz pam_wrapper-7505e1c7f93fae556bb92b19922791bc703b6be1.zip |
py: Fix strict aliasing rules in set_pypamtest_exception()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
-rw-r--r-- | src/python/pypamtest.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c index a1b5dd6..d453c6c 100644 --- a/src/python/pypamtest.c +++ b/src/python/pypamtest.c @@ -260,6 +260,10 @@ set_pypamtest_exception(PyObject *exc, PyObject *obj = NULL; /* repr_fmt is fixed and contains just %d expansions, so this is safe */ char test_repr[256] = { '\0' }; + union { + char *str; + PyObject *obj; + } pypam_str_object; const char *strerr; const struct pam_testcase *failed = NULL; @@ -291,7 +295,8 @@ set_pypamtest_exception(PyObject *exc, PyErr_SetObject(exc, obj); } - Py_XDECREF(test_repr); + pypam_str_object.str = test_repr; + Py_XDECREF(pypam_str_object.obj); Py_XDECREF(obj); } |