]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Minor code hardening; check that two bytes following '%' are non-NULL
authorTim Kientzle <kientzle@gmail.com>
Wed, 28 May 2008 22:16:53 +0000 (18:16 -0400)
committerTim Kientzle <kientzle@gmail.com>
Wed, 28 May 2008 22:16:53 +0000 (18:16 -0400)
before we try to use them.

SVN-Revision: 100

libarchive/archive_read_support_format_tar.c

index 6d7f048a40d8989fc5fc212f9a5074a7a72ac947..7bd840d62a0869d87640e9707495944abe73f1d2 100644 (file)
@@ -2362,7 +2362,7 @@ url_decode(const char *in)
        if (out == NULL)
                return (NULL);
        for (s = in, d = out; *s != '\0'; ) {
-               if (*s == '%') {
+               if (s[0] == '%' && s[1] != '\0' && s[2] != '\0') {
                        /* Try to convert % escape */
                        int digit1 = tohex(s[1]);
                        int digit2 = tohex(s[2]);