]> granicus.if.org Git - file/commitdiff
Fix offset update for pstrings (Debian bug #466033)
authorReuben Thomas <rrt@sc3d.org>
Mon, 18 Feb 2008 00:43:45 +0000 (00:43 +0000)
committerReuben Thomas <rrt@sc3d.org>
Mon, 18 Feb 2008 00:43:45 +0000 (00:43 +0000)
magic/Magdir/perl
src/apprentice.c
src/softmagic.c

index e046dc39b90b67f1974fab646a5e8ba6fcd1961b..1588306038395474486e60bd32659387bdc95d18 100644 (file)
@@ -24,8 +24,8 @@
 # by Dmitry V. Levin and Alexey Tourbin
 # check the first line
 0      string          package
->1     regex           \^package[\ \t]+[A-Za-z_]
->>1    regex           \^package[\ \t]+[0-9A-Za-z_:]*\ *;      Perl5 module source text
+     regex           \^package[\ \t]+[A-Za-z_]
+>0     regex           \^package[\ \t]+[0-9A-Za-z_:]+\ *;      Perl5 module source text
 # not 'p', check other lines
 0      byte            !0x70
 >0     regex           \^package[\ \t]+[0-9A-Za-z_:]+\ *;
index 6c8608198ea3c113ee718959c0ccce9efc6752ed..a1656b97fa1febaf1f64f1ba4c810805fd7d7624 100644 (file)
@@ -47,7 +47,7 @@
 #endif
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.117 2008/02/17 19:28:54 rrt Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.118 2008/02/17 23:40:48 rrt Exp $")
 #endif /* lint */
 
 #define        EATAB {while (isascii((unsigned char) *l) && \
@@ -1471,6 +1471,8 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
                        return -1;
                }
                m->vallen = slen;
+               if (m->type == FILE_PSTRING)
+                       m->vallen++;
                return 0;
        case FILE_FLOAT:
        case FILE_BEFLOAT:
index 5bff875f567878a86c5c90a943e0e4cfe15a3868..e68579a3dd40b060c5c6afa5c19f6543696cd923 100644 (file)
@@ -38,7 +38,7 @@
 
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.109 2008/02/12 15:28:39 rrt Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.110 2008/02/17 19:28:54 rrt Exp $")
 #endif /* lint */
 
 private int match(struct magic_set *, struct magic *, uint32_t,
@@ -413,6 +413,8 @@ mprint(struct magic_set *ms, struct magic *m)
                        if (file_printf(ms, MAGIC_DESC, p->s) == -1)
                                return -1;
                        t = ms->offset + strlen(p->s);
+                       if (m->type == FILE_PSTRING)
+                               t++;
                }
                break;