Show More
@@ -52,6 +52,7 b' static int _addpath(PyObject *dirs, PyOb' | |||||
52 | { |
|
52 | { | |
53 | const char *cpath = PyBytes_AS_STRING(path); |
|
53 | const char *cpath = PyBytes_AS_STRING(path); | |
54 | Py_ssize_t pos = PyBytes_GET_SIZE(path); |
|
54 | Py_ssize_t pos = PyBytes_GET_SIZE(path); | |
|
55 | Py_ssize_t prev_pos = -1; | |||
55 | PyObject *key = NULL; |
|
56 | PyObject *key = NULL; | |
56 | int ret = -1; |
|
57 | int ret = -1; | |
57 |
|
58 | |||
@@ -64,6 +65,13 b' static int _addpath(PyObject *dirs, PyOb' | |||||
64 | * locations, the references are known so these violations should go |
|
65 | * locations, the references are known so these violations should go | |
65 | * unnoticed. */ |
|
66 | * unnoticed. */ | |
66 | while ((pos = _finddir(cpath, pos - 1)) != -1) { |
|
67 | while ((pos = _finddir(cpath, pos - 1)) != -1) { | |
|
68 | if (pos && prev_pos == pos + 1) { | |||
|
69 | PyErr_SetString( | |||
|
70 | PyExc_ValueError, | |||
|
71 | "invalid empty directory name in dirs.c _addpath"); | |||
|
72 | return -1; | |||
|
73 | } | |||
|
74 | prev_pos = pos; | |||
67 | PyObject *val; |
|
75 | PyObject *val; | |
68 |
|
76 | |||
69 | key = PyBytes_FromStringAndSize(cpath, pos); |
|
77 | key = PyBytes_FromStringAndSize(cpath, pos); |
General Comments 0
You need to be logged in to leave comments.
Login now