bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #54533] Touching an archive member leaves a NUL byte after date fie


From: anonymous
Subject: [bug #54533] Touching an archive member leaves a NUL byte after date field
Date: Sat, 18 Aug 2018 11:01:19 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

URL:
  <http://savannah.gnu.org/bugs/?54533>

                 Summary: Touching an archive member leaves a NUL byte after
date field
                 Project: make
            Submitted by: None
            Submitted on: Sat 18 Aug 2018 03:01:18 PM UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.2.1
        Operating System: POSIX-Based
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

When make touches an archive member via something like:

touch b
ar -rc a b
make -Bt 'a(b)'

$ xxd a
00000000: 213c 6172 6368 3e0a 622f 2020 2020 2020  !<arch>.b/      
00000010: 2020 2020 2020 2020 3135 3334 3630 3435          15346045
00000020: 3631 0020 3020 2020 2020 3020 2020 2020  61. 0     0     
00000030: 3634 3420 2020 2020 3020 2020 2020 2020  644     0       
00000040: 2020 600a

note the NUL at offset 22

This looks to be caused in arscan.c :

>  903 #if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) ||
defined(WINDOWS32)`
>  904   /* Advance member's time to that time */`
>  905   for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++)`
>  906     ar_hdr.ar_date[ui] = ' ';`
>  907   sprintf (TOCHAR (ar_hdr.ar_date), "%lu", (long unsigned)
statbuf.st_mtime);`
>  908 #ifdef AIAMAG`
>  909   ar_hdr.ar_date[strlen (ar_hdr.ar_date)] = ' ';`
>  910 #endif`
>  911 #else`
>  912   ar_hdr.ar_date = statbuf.st_mtime;`
>  913 #endif`

I think the "ifdef AIAMAG" should be removed as you always want the NUL byte
after the sprintf set back to a space.  Maybe make sure that the field is not
overrun.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54533>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]