diff -ru arj-3.10.22/arj_arcv.c arj-3.10.22-patched/arj_arcv.c --- arj-3.10.22/arj_arcv.c 2005-06-21 21:53:12.000000000 +0200 +++ arj-3.10.22-patched/arj_arcv.c 2011-09-11 18:10:09.000000000 +0200 @@ -59,27 +59,27 @@ #define setup_hput(ptr) (tmp_hptr=(ptr)) #define hget_byte() (*(tmp_hptr++)&0xFF) -#define hput_byte(c) (*(tmp_hptr++)=(char) (c)) +#define hput_byte(c) (*(tmp_hptr++)=(uint8_t) (c)) /* Reads two bytes from the header, incrementing the pointer */ -static unsigned int hget_word() +static uint16_t hget_word() { - unsigned int result; + uint16_t result; result=mget_word(tmp_hptr); - tmp_hptr+=sizeof(short); + tmp_hptr+=sizeof(uint16_t); return result; } /* Reads four bytes from the header, incrementing the pointer */ -static unsigned long hget_longword() +static uint32_t hget_longword() { - unsigned long result; + uint32_t result; result=mget_dword(tmp_hptr); - tmp_hptr+=sizeof(unsigned long); + tmp_hptr+=sizeof(uint32_t); return result; } @@ -87,18 +87,18 @@ /* Writes two bytes to the header, incrementing the pointer */ -static void hput_word(unsigned int w) +static void hput_word(uint16_t w) { mput_word(w,tmp_hptr); - tmp_hptr+=sizeof(unsigned short); + tmp_hptr+=sizeof(uint16_t); } /* Writes four bytes to the header, incrementing the pointer */ -static void hput_longword(unsigned long l) +static void hput_longword(uint32_t l) { mput_dword(l,tmp_hptr); - tmp_hptr+=sizeof(unsigned long); + tmp_hptr+=sizeof(uint32_t); } /* Calculates and stores the basic header size */ diff -ru arj-3.10.22/arj_proc.c arj-3.10.22-patched/arj_proc.c --- arj-3.10.22/arj_proc.c 2005-06-21 21:53:12.000000000 +0200 +++ arj-3.10.22-patched/arj_proc.c 2011-09-11 18:10:09.000000000 +0200 @@ -585,7 +585,7 @@ /* Returns the exact amount of data that could be safely written to the destination volume */ -unsigned long get_volfree(unsigned int increment) +unsigned long get_volfree(unsigned long increment) { unsigned long pvol; unsigned int arjsec_overhead; @@ -605,7 +605,7 @@ remain=volume_limit-ftell(aostream)-pvol-(long)arjsec_overhead- (long)out_bytes-(long)cpos-(long)ext_voldata- MULTIVOLUME_RESERVE-t_volume_offset; - return((unsigned long)min(remain, (unsigned long)increment)); + return((unsigned long)min(remain, increment)); } /* Performs various checks when multivolume data is packed to predict an @@ -2466,14 +2466,14 @@ *tsptr='\0'; endptr=tsptr; tsptr=sptr; - while((unsigned int)tsptr<(unsigned int)endptr&&patterns>8 , p+1); @@ -2931,7 +2931,7 @@ /* Model-independent routine to store 4 bytes in far RAM */ -void mput_dword(unsigned long d, char FAR *p) +void mput_dword(uint32_t d, char FAR *p) { mput_word(d&0xFFFF, p); mput_word(d>>16 , p+2); diff -ru arj-3.10.22/arj_proc.h arj-3.10.22-patched/arj_proc.h --- arj-3.10.22/arj_proc.h 2004-01-25 11:39:30.000000000 +0100 +++ arj-3.10.22-patched/arj_proc.h 2011-09-11 18:10:09.000000000 +0200 @@ -8,15 +8,17 @@ #ifndef ARJ_PROC_INCLUDED #define ARJ_PROC_INCLUDED +#include + /* Helper macros */ -#define mget_byte(p) (*(unsigned char FAR *)(p)&0xFF) -#define mput_byte(c, p) *(unsigned char FAR *)(p)=(unsigned char)(c) +#define mget_byte(p) (*(uint8_t FAR *)(p)&0xFF) +#define mput_byte(c, p) *(uint8_t FAR *)(p)=(uint8_t)(c) #ifndef WORDS_BIGENDIAN -#define mget_word(p) (*(unsigned short *)(p)&0xFFFF) -#define mput_word(w,p) (*(unsigned short *)(p)=(unsigned short)(w)) -#define mget_dword(p) (*(unsigned long *)(p)) -#define mput_dword(w,p) (*(unsigned long *)(p)=(unsigned long)(w)) +#define mget_word(p) (*(uint16_t *)(p)&0xFFFF) +#define mput_word(w,p) (*(uint16_t *)(p)=(uint16_t)(w)) +#define mget_dword(p) (*(uint32_t *)(p)) +#define mput_dword(w,p) (*(uint32_t *)(p)=(uint32_t)(w)) #endif /* Prototypes */ @@ -31,7 +33,7 @@ int translate_path(char *name); void restart_proc(char *dest); int search_for_extension(char *name, char *ext_list); -unsigned long get_volfree(unsigned int increment); +unsigned long get_volfree(unsigned long increment); unsigned int check_multivolume(unsigned int increment); void store(); void hollow_encode(); @@ -61,10 +63,10 @@ void strip_lf(char *str); char *ltrim(char *str); #ifdef WORDS_BIGENDIAN -unsigned int mget_word(char FAR *p); -unsigned long mget_dword(char FAR *p); -void mput_word(unsigned int w, char FAR *p); -void mput_dword(unsigned long d, char FAR *p); +uint16_t mget_word(char FAR *p); +uint32_t mget_dword(char FAR *p); +void mput_word(uint16_t w, char FAR *p); +void mput_dword(uint32_t d, char FAR *p); #endif #endif diff -ru arj-3.10.22/environ.c arj-3.10.22-patched/environ.c --- arj-3.10.22/environ.c 2004-06-18 18:19:36.000000000 +0200 +++ arj-3.10.22-patched/environ.c 2011-09-11 18:10:09.000000000 +0200 @@ -58,7 +58,7 @@ #include #include #include - #elif defined(__FreeBSD__)||defined(__NetBSD__) + #elif defined(__APPLE__)||defined(__NetBSD__) #include #include #elif defined(__QNXNTO__) diff -ru arj-3.10.22/fardata.c arj-3.10.22-patched/fardata.c --- arj-3.10.22/fardata.c 2004-04-17 13:39:42.000000000 +0200 +++ arj-3.10.22-patched/fardata.c 2011-09-11 18:13:03.000000000 +0200 @@ -190,7 +190,7 @@ /* Length-limited strlen() */ -static int strnlen(const char FAR *s, int count) +static int strnlen_intern(const char FAR *s, int count) { const char FAR *sc; @@ -569,7 +569,7 @@ if(!s) s="(null)"; #endif - len=strnlen(s, precision); + len=strnlen_intern(s, precision); if(!(flags&LEFT)) { while(len Origin: vendor Bug-Debian: https://bugs.debian.org/590354 Forwarded: no Last-Update: 2010-07-26 --- arj.c | 2 +- arjdata.c | 9 +-------- ea_mgr.c | 2 +- misc.h | 4 ++++ msgbind.c | 2 +- packager.c | 2 +- 6 files changed, 9 insertions(+), 12 deletions(-) --- a/arjdata.c +++ b/arjdata.c @@ -204,13 +204,6 @@ void date_fmt(char *dest) #endif } -/* A safe strcpy() */ - -static void safe_strcpy(char *dest, char *src) -{ - memmove(dest, src, strlen(src)+1); -} - /* Context substitution routine */ char *expand_tags(char *str, int limit) @@ -232,7 +225,7 @@ char *expand_tags(char *str, int limit) { if(*(p+1)==TAG_CHAR) { - strcpy(p, p+1); + safe_strcpy(p, p+1); p++; } else if(*(p+1)==TAG_SPECIAL_BEGIN&&(et=strchr(p+3, TAG_SPECIAL_END))!=NULL) --- a/arj.c +++ b/arj.c @@ -1169,7 +1169,7 @@ int main(int argc, char *argv[]) if(strlen(tmp_ptr)<=121) tmp_ptr[0]='\0'; else if(tmp_ptr[120]==' ') - strcpy(tmp_ptr, tmp_ptr+121); + safe_strcpy(tmp_ptr, tmp_ptr+121); } if(cmd==ARJ_CMD_ORDER&&strpbrk(tmp_ptr, wildcard_pattern)!=NULL) error(M_ORDER_WILDCARD); --- a/ea_mgr.c +++ b/ea_mgr.c @@ -696,7 +696,7 @@ int resolve_longname(char *dest, char *n tmp_name[st_len]='\0'; if(tmp_name[0]==0xFD&&tmp_name[1]==0xFF) { - strcpy(tmp_name, (char *)tmp_name+4); + safe_strcpy(tmp_name, (char *)tmp_name+4); st_len-=4; } if(st_len==0||st_len+entry>=FILENAME_MAX) --- a/msgbind.c +++ b/msgbind.c @@ -578,7 +578,7 @@ int main(int argc, char **argv) } strcat(pool[tpool].data, msgname); strcat(pool[tpool].data, ", "); - strcpy(msg_buffer, msg_buffer+1); + safe_strcpy(msg_buffer, msg_buffer+1); buf_len=strlen(msg_buffer); msg_buffer[--buf_len]='\0'; patch_string(msg_buffer); --- a/packager.c +++ b/packager.c @@ -347,7 +347,7 @@ int main(int argc, char **argv) expand_tags(buf, sizeof(buf)-1); if((p=strchr(buf, '.'))!=NULL) { - strcpy(p, p+1); + safe_strcpy(p, p+1); if((p=strchr(buf, '.'))!=NULL) *p='\0'; } --- a/misc.h +++ b/misc.h @@ -11,6 +11,10 @@ #include "arjtypes.h" #include "filelist.h" +/* A safe strcpy() */ + +#define safe_strcpy(dest, src) memmove(dest, src, strlen(src)+1); + /* ASCIIZ string copy macro */ #define strcpyn(dest, src, n) \