there was no verification that privateobj was a PyString. If it wasn't
a string, this could have allowed a NULL pointer to creep in below and crash.
I wonder if this should be PyString_CheckExact? Must identifiers be strings
or can they be subclasses?
Klocwork #275
const char *p, *name = PyString_AsString(ident);
char *buffer;
size_t nlen, plen;
- if (privateobj == NULL || name == NULL || name[0] != '_' ||
- name[1] != '_') {
+ if (privateobj == NULL || !PyString_Check(privateobj) ||
+ name == NULL || name[0] != '_' || name[1] != '_') {
Py_INCREF(ident);
return ident;
}