diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2011-08-10 19:43:52 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2011-08-10 19:43:52 -0700 |
commit | be7457245594fdc56ee23306eb6e3962f7333fc7 (patch) | |
tree | 66f23b8157ff1574177a2edb36d288bb4b0ab33c /lang_ext/python | |
parent | fc9c49860b56ce13fc24e1c309431fffa1e84804 (diff) |
Fixed off-by-one stack allocation error.
Diffstat (limited to 'lang_ext/python')
-rw-r--r-- | lang_ext/python/upb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lang_ext/python/upb.c b/lang_ext/python/upb.c index d82fba8..b6a1ab6 100644 --- a/lang_ext/python/upb.c +++ b/lang_ext/python/upb.c @@ -78,7 +78,7 @@ static PyObject *weakref_callback = NULL; static PyObject *PyUpb_ObjCacheDeleteCallback(PyObject *self, PyObject *ref) { // Remove the value from the weak table. PyUpb_ObjWrapper *tmp = (PyUpb_ObjWrapper*)PyWeakref_GetObject(ref); - char key[sizeof(void*)]; + char key[sizeof(void*) + 1]; key[sizeof(void*)] = '\0'; memcpy(key, &tmp->obj, sizeof(void*)); PyDict_DelItemString(obj_cache, key); @@ -86,7 +86,7 @@ static PyObject *PyUpb_ObjCacheDeleteCallback(PyObject *self, PyObject *ref) { } static PyObject *PyUpb_ObjCacheGet(void *obj, PyTypeObject *type) { - char key[sizeof(void*)]; + char key[sizeof(void*) + 1]; key[sizeof(void*)] = '\0'; memcpy(key, &obj, sizeof(void*)); PyObject *ref = PyDict_GetItemString(obj_cache, key); |