]> granicus.if.org Git - python/commitdiff
Avoid potential for undefined variable 'startinpos' in PyUnicode_DecodeUTF7().
authorGuido van Rossum <guido@python.org>
Thu, 5 Mar 2009 21:47:33 +0000 (21:47 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 5 Mar 2009 21:47:33 +0000 (21:47 +0000)
See issue #5389.

Objects/unicodeobject.c

index 4c308ccfe0a9fbe6ce8817ffea9fec2b7674a6ab..af6f67a18b2f7c45cbe0e81003a592fa3aa36b37 100644 (file)
@@ -1012,7 +1012,7 @@ PyObject *PyUnicode_DecodeUTF7(const char *s,
                     }
                 } else if (SPECIAL(ch,0,0)) {
                     errmsg = "unexpected special character";
-                       goto utf7Error;
+                   goto utf7Error;
                 } else  {
                     *p++ = ch;
                 }
@@ -1036,9 +1036,10 @@ PyObject *PyUnicode_DecodeUTF7(const char *s,
             }
         }
         else if (SPECIAL(ch,0,0)) {
+            startinpos = s-starts;
             errmsg = "unexpected special character";
             s++;
-               goto utf7Error;
+            goto utf7Error;
         }
         else {
             *p++ = ch;