Nevermind, I found the bug in the source. It actually fumbles if the
backslash *isn't the last character in the format unit*.

New patch attached, fixes up escape() in hexdump/parse.c

I don't know if there is an upstream to report this to, but other
distributions are affected.
--- bsdmainutils/usr.bin/hexdump/parse.c 2015-09-04 09:04:57.000000000 -0400
+++ bsdmainutils/usr.bin/hexdump/parse.c 2015-09-04 09:04:57.000000000 -0400
@@ -454,10 +454,6 @@
 
        /* alphabetic escape sequences have to be done in place */
        for (p2 = p1;; ++p1, ++p2) {
-               if (!*p1) {
-                       *p2 = *p1;
-                       break;
-               }
                if (*p1 == '\\')
                        switch(*++p1) {
                        case 'a':
@@ -486,6 +482,11 @@
                                *p2 = *p1;
                                break;
                        }
+        else {
+            *p2 = *p1;
+            if(!*p1)
+                break;
+        }
        }
 }
 

Reply via email to