]> granicus.if.org Git - python/commitdiff
Address a bug in the uuencode decoder, reported bu "donut" in SF bug
authorGuido van Rossum <guido@python.org>
Tue, 9 Jan 2001 02:11:57 +0000 (02:11 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 9 Jan 2001 02:11:57 +0000 (02:11 +0000)
#127718: '@' and '`' seem to be confused.

Modules/binascii.c

index 010e22d9c8fcf654ec5a5ba0cd04f634c48374dc..85edd044f6e8c51de9d7cb8808eadb11bc71bd16 100644 (file)
@@ -204,7 +204,7 @@ binascii_a2b_uu(PyObject *self, PyObject *args)
                        /* Check the character for legality
                        ** The 64 in stead of the expected 63 is because
                        ** there are a few uuencodes out there that use
-                       ** '@' as zero instead of space.
+                       ** '`' as zero instead of space.
                        */
                        if ( this_ch < ' ' || this_ch > (' ' + 64)) {
                                PyErr_SetString(Error, "Illegal char");
@@ -232,8 +232,8 @@ binascii_a2b_uu(PyObject *self, PyObject *args)
        */
        while( ascii_len-- > 0 ) {
                this_ch = *ascii_data++;
-               /* Extra '@' may be written as padding in some cases */
-               if ( this_ch != ' ' && this_ch != '@' &&
+               /* Extra '`' may be written as padding in some cases */
+               if ( this_ch != ' ' && this_ch != ' '+64 &&
                     this_ch != '\n' && this_ch != '\r' ) {
                        PyErr_SetString(Error, "Trailing garbage");
                        Py_DECREF(rv);