Issue #6697: Fixed instances of _PyUnicode_AsString() result not checked for NULL

This commit is contained in:
Alexander Belopolsky 2010-12-08 23:31:48 +00:00
parent 1b2bd3b348
commit e239d23e8c
13 changed files with 144 additions and 78 deletions

View file

@ -1406,9 +1406,9 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
{
struct sockaddr_hci *addr = (struct sockaddr_hci *)addr_ret;
#if defined(__NetBSD__) || defined(__DragonFly__)
char *straddr = PyBytes_AS_STRING(args);
char *straddr = PyBytes_AS_STRING(args);
_BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
_BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
if (straddr == NULL) {
PyErr_SetString(socket_error, "getsockaddrarg: "
"wrong format");
@ -4022,8 +4022,10 @@ socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
pptr = pbuf;
} else if (PyUnicode_Check(pobj)) {
pptr = _PyUnicode_AsString(pobj);
if (pptr == NULL)
goto err;
} else if (PyBytes_Check(pobj)) {
pptr = PyBytes_AsString(pobj);
pptr = PyBytes_AS_STRING(pobj);
} else if (pobj == Py_None) {
pptr = (char *)NULL;
} else {