wok-next diff arj/stuff/patches/use_safe_strcpy.patch @ rev 19715

Fix building: pciutils, pcmanfm-legacy, arj
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat May 13 17:25:31 2017 +0300 (2017-05-13)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/arj/stuff/patches/use_safe_strcpy.patch	Sat May 13 17:25:31 2017 +0300
     1.3 @@ -0,0 +1,97 @@
     1.4 +Patch by Guillem Jover <guillem@debian.org> for arj <= 3.10.22, to
     1.5 +use a safe strcpy for overlapping strings, among others fixes a build
     1.6 +problem with a mangled generated .c file by msgbind (thus FTBFS), and
     1.7 +CRC errors at run-time. For further information, please have a look
     1.8 +to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=590354
     1.9 +
    1.10 +---
    1.11 + arj.c      |    2 +-
    1.12 + arjdata.c  |    9 +--------
    1.13 + ea_mgr.c   |    2 +-
    1.14 + misc.h     |    4 ++++
    1.15 + msgbind.c  |    2 +-
    1.16 + packager.c |    2 +-
    1.17 + 6 files changed, 9 insertions(+), 12 deletions(-)
    1.18 +
    1.19 +--- a/arjdata.c
    1.20 ++++ b/arjdata.c
    1.21 +@@ -204,13 +204,6 @@ void date_fmt(char *dest)
    1.22 +  #endif
    1.23 + }
    1.24 + 
    1.25 +-/* A safe strcpy() */
    1.26 +-
    1.27 +-static void safe_strcpy(char *dest, char *src)
    1.28 +-{
    1.29 +- memmove(dest, src, strlen(src)+1);
    1.30 +-}
    1.31 +-
    1.32 + /* Context substitution routine */
    1.33 + 
    1.34 + char *expand_tags(char *str, int limit)
    1.35 +@@ -232,7 +225,7 @@ char *expand_tags(char *str, int limit)
    1.36 +   {
    1.37 +    if(*(p+1)==TAG_CHAR)
    1.38 +    {
    1.39 +-    strcpy(p, p+1);
    1.40 ++    safe_strcpy(p, p+1);
    1.41 +     p++;
    1.42 +    }
    1.43 +    else if(*(p+1)==TAG_SPECIAL_BEGIN&&(et=strchr(p+3, TAG_SPECIAL_END))!=NULL)
    1.44 +--- a/arj.c
    1.45 ++++ b/arj.c
    1.46 +@@ -1169,7 +1169,7 @@ int main(int argc, char *argv[])
    1.47 +      if(strlen(tmp_ptr)<=121)
    1.48 +       tmp_ptr[0]='\0';
    1.49 +      else if(tmp_ptr[120]==' ')
    1.50 +-      strcpy(tmp_ptr, tmp_ptr+121);
    1.51 ++      safe_strcpy(tmp_ptr, tmp_ptr+121);
    1.52 +     }
    1.53 +     if(cmd==ARJ_CMD_ORDER&&strpbrk(tmp_ptr, wildcard_pattern)!=NULL)
    1.54 +      error(M_ORDER_WILDCARD);
    1.55 +--- a/ea_mgr.c
    1.56 ++++ b/ea_mgr.c
    1.57 +@@ -696,7 +696,7 @@ int resolve_longname(char *dest, char *n
    1.58 +     tmp_name[st_len]='\0';
    1.59 +     if(tmp_name[0]==0xFD&&tmp_name[1]==0xFF)
    1.60 +     {
    1.61 +-     strcpy(tmp_name, (char *)tmp_name+4);
    1.62 ++     safe_strcpy(tmp_name, (char *)tmp_name+4);
    1.63 +      st_len-=4;
    1.64 +     }
    1.65 +     if(st_len==0||st_len+entry>=FILENAME_MAX)
    1.66 +--- a/msgbind.c
    1.67 ++++ b/msgbind.c
    1.68 +@@ -578,7 +578,7 @@ int main(int argc, char **argv)
    1.69 +    }
    1.70 +    strcat(pool[tpool].data, msgname);
    1.71 +    strcat(pool[tpool].data, ", ");
    1.72 +-   strcpy(msg_buffer, msg_buffer+1);
    1.73 ++   safe_strcpy(msg_buffer, msg_buffer+1);
    1.74 +    buf_len=strlen(msg_buffer);
    1.75 +    msg_buffer[--buf_len]='\0';
    1.76 +    patch_string(msg_buffer);
    1.77 +--- a/packager.c
    1.78 ++++ b/packager.c
    1.79 +@@ -347,7 +347,7 @@ int main(int argc, char **argv)
    1.80 +  expand_tags(buf, sizeof(buf)-1);
    1.81 +  if((p=strchr(buf, '.'))!=NULL)
    1.82 +  {
    1.83 +-  strcpy(p, p+1);
    1.84 ++  safe_strcpy(p, p+1);
    1.85 +   if((p=strchr(buf, '.'))!=NULL)
    1.86 +    *p='\0';
    1.87 +  }
    1.88 +--- a/misc.h
    1.89 ++++ b/misc.h
    1.90 +@@ -11,6 +11,10 @@
    1.91 + #include "arjtypes.h"
    1.92 + #include "filelist.h"
    1.93 + 
    1.94 ++/* A safe strcpy() */
    1.95 ++
    1.96 ++#define safe_strcpy(dest, src) memmove(dest, src, strlen(src)+1);
    1.97 ++
    1.98 + /* ASCIIZ string copy macro */
    1.99 + 
   1.100 + #define strcpyn(dest, src, n)      \