]> granicus.if.org Git - python/commitdiff
Reject empty module names -- otherwise __import__("") does something
authorGuido van Rossum <guido@python.org>
Sat, 11 Apr 1998 17:38:22 +0000 (17:38 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 11 Apr 1998 17:38:22 +0000 (17:38 +0000)
weird!

Python/import.c

index 6eb794f2980f72b0e3c985b0e4eb289f84126a68..afbd4d8ba3ba78add8bf57f9e4d2176d5abe0e20 100644 (file)
@@ -1515,6 +1515,11 @@ load_next(mod, altmod, p_name, buf, p_buflen)
                *p_name = dot+1;
                len = dot-name;
        }
+       if (len == 0) {
+               PyErr_SetString(PyExc_ValueError,
+                               "Empty module name");
+               return NULL;
+       }
 
        p = buf + *p_buflen;
        if (p != buf)