diff options
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 461096c..4e936e2 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1692,8 +1692,10 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, struct sockaddr_un* addr = &addrbuf->un; #ifdef __linux__ - if (path.len > 0 && *(const char *)path.buf == 0) { - /* Linux abstract namespace extension */ + if (path.len == 0 || *(const char *)path.buf == 0) { + /* Linux abstract namespace extension: + - Empty address auto-binding to an abstract address + - Address that starts with null byte */ if ((size_t)path.len > sizeof addr->sun_path) { PyErr_SetString(PyExc_OSError, "AF_UNIX path too long"); |