1 Patch by Guillem Jover <guillem@debian.org> for arj <= 3.10.22, which
2 fixes format security errors.
5 arj_arcv.c | 12 ++++++------
6 arj_user.c | 8 ++++----
7 arjdisp.c | 58 ++++++++++++++++++++++++++++------------------------------
9 fardata.c | 10 +++++-----
12 7 files changed, 46 insertions(+), 48 deletions(-)
16 @@ -52,7 +52,7 @@ int error_proc(FMSG *errmsg, ...)
17 /* Check if the message could have a standard error code */
18 if(errno!=0&&is_std_error(errmsg))
21 + msg_cprintf(0, "\n");
25 @@ -379,10 +379,10 @@ static void flush_cbuf(int ccode, char *
27 #if SFX_LEVEL>=ARJSFXV
28 fprintf(new_stdout, strform, n_text);
29 - fprintf(new_stdout, lf);
30 + fprintf(new_stdout, "\n");
32 printf(strform, n_text);
38 @@ -393,13 +393,13 @@ static void flush_cbuf(int ccode, char *
46 textcolor(color_table[ccode&H_COLORMASK].color);
48 printf(strform, n_text);
56 @@ -1059,7 +1059,7 @@ static void finish_processing(int cmd)
57 if(recover_file(tmp_archive_name, nullstr, tmp_tmp_filename, protected, eof_pos))
59 msg_cprintf(H_HL, M_CANT_FIND_DAMAGE, archive_name);
65 @@ -1294,7 +1294,7 @@ static void finish_processing(int cmd)
66 if(recover_file(archive_name, nullstr, nullstr, protected, eof_pos))
68 msg_cprintf(H_HL, M_CANT_FIND_DAMAGE, archive_name);
74 @@ -1327,7 +1327,7 @@ static void finish_processing(int cmd)
75 msg_cprintf(0, M_CHAPTERS_ON);
76 else if(chapter_mode==CHAP_REMOVE)
77 msg_cprintf(0, M_CHAPTERS_OFF);
78 - msg_cprintf(0, strform, lf);
79 + msg_cprintf(0, strform, "\n");
81 if(cmd==ARJ_CMD_COPY&&protfile_option&&!arjprot_tail)
82 msg_cprintf(0, M_ARJPROT_DISABLED);
83 @@ -2303,7 +2303,7 @@ void process_archive()
84 timestamp_to_str(timetext, &ftime_stamp);
85 msg_cprintf(H_HL|H_NFMT, M_ARCHIVE_CREATED, timetext);
86 if(show_ansi_comments)
88 + fputs(cmt_ptr, stdout);
90 display_comment(cmt_ptr);
91 /* The sfx_setup() occurs here */
94 @@ -913,13 +913,13 @@ int supply_comment(char *cmtname, char *
97 strcat(tmp_comment, tmp_cmtline);
98 - strcat(tmp_comment, lf);
99 + strcat(tmp_comment, "\n");
104 strcat(tmp_comment, tmp_cmtline);
105 - strcat(tmp_comment, lf);
106 + strcat(tmp_comment, "\n");
110 @@ -1846,7 +1846,7 @@ int pack_file(int is_update, int is_repl
111 raw_eh=eh_lookup(eh, UXSPECIAL_ID)->raw;
112 uxspecial_stats(raw_eh, UXSTATS_SHORT);
114 - msg_cprintf(0, lf);
115 + msg_cprintf(0, "\n");
117 if(err_id==0&&user_wants_fail)
119 @@ -2523,9 +2523,9 @@ int unpack_validation()
121 msg_cprintf(0, (FMSG *)strform, misc_buf);
122 if(search_mode==SEARCH_DEFAULT)
123 - msg_cprintf(0, (FMSG *)lf);
124 + msg_cprintf(0, "\n");
125 if(search_mode==SEARCH_BRIEF)
126 - msg_cprintf(0, (FMSG *)cr);
127 + msg_cprintf(0, "\r");
129 for(pattern=0; pattern<SEARCH_STR_MAX; search_occurences[pattern++]=0);
131 @@ -3652,7 +3652,7 @@ void archive_cleanup()
133 if(msg_fprintf(idxstream, M_TESTING, archive_name)<0)
135 - if(fprintf(idxstream, lf)<0)
136 + if(fprintf(idxstream, "\n")<0)
139 cmd_verb=ARJ_CMD_TEST;
142 @@ -214,7 +214,7 @@ static void final_cleanup(void)
143 freopen(dev_con, m_w, stdout);
144 #if SFX_LEVEL>=ARJSFXV
146 - msg_fprintf(stderr, M_DISK_FULL);
147 + msg_fprintf(stderr, "Can't write file. Disk full?");
148 if(debug_enabled&&strchr(debug_opt, 't')!=NULL)
150 ticks=get_ticks()-ticks;
153 @@ -935,7 +935,7 @@ static int convert_archive(char *name)
154 msg_cprintf(H_HL|H_NFMT, M_OLD_SIZE, old_fsize);
155 msg_cprintf(H_HL|H_NFMT, M_NEW_SIZE, new_fsize);
156 msg_cprintf(H_HL|H_NFMT, M_SAVINGS_SIZE, gain);
159 total_old_fsize+=old_fsize;
160 total_new_fsize+=new_fsize;
164 @@ -205,7 +205,7 @@ int main(int argc, char **argv)
165 char reg_source[200];
168 - printf(M_REGISTER_BANNER);
169 + fputs(M_REGISTER_BANNER, stdout);
170 integrity_pattern[0]--;
175 @@ -20,8 +20,6 @@ static long bytes;
176 static long compsize;
177 static char cmd_verb;
178 static char msg_lf[]="\n";
179 -char strform[]="%s"; /* Export it for scrnio.c, too
180 - (a byte saved is a byte gained) */
182 /* Pseudographical controls */
184 @@ -54,19 +52,19 @@ static void show_init_scrn()
188 - scrprintf(win_top);
189 + fputs(win_top, stdout);
192 - gotoxy(2, i); scrprintf(win_border);
193 - gotoxy(79, i); scrprintf(win_border);
194 + gotoxy(2, i); fputs(win_border, stdout);
195 + gotoxy(79, i); fputs(win_border, stdout);
197 - gotoxy(2, 24); scrprintf(win_bottom);
198 + gotoxy(2, 24); fputs(win_bottom, stdout);
200 - scrprintf(M_ARJDISP_COPYRIGHT);
201 + fputs(M_ARJDISP_COPYRIGHT, stdout);
203 - scrprintf(M_ARJDISP_DISTRIBUTION);
204 + fputs(M_ARJDISP_DISTRIBUTION, stdout);
206 - scrprintf(M_ARJDISP_LICENSE);
207 + fputs(M_ARJDISP_LICENSE, stdout);
209 scrprintf(M_PROCESSING_ARCHIVE, archive_name);
210 t=strtok(M_ARJDISP_INFO, msg_lf);
211 @@ -74,11 +72,11 @@ static void show_init_scrn()
212 while(t!=NULL&&i<=23)
215 - scrprintf(strform, t);
216 + scrprintf("%s", t);
217 t=strtok(NULL, msg_lf);
220 - scrprintf(M_PRESS_ANY_KEY);
221 + fputs(M_PRESS_ANY_KEY, stdout);
225 @@ -96,19 +94,19 @@ static void show_proc_scrn()
229 - scrprintf(win_top);
230 + fputs(win_top, stdout);
233 - gotoxy(2, i); scrprintf(win_border);
234 - gotoxy(79, i); scrprintf(win_border);
235 + gotoxy(2, i); fputs(win_border, stdout);
236 + gotoxy(79, i); fputs(win_border, stdout);
238 - gotoxy(2, 24); scrprintf(win_bottom);
239 + gotoxy(2, 24); fputs(win_bottom, stdout);
241 - scrprintf(M_ARJDISP_COPYRIGHT);
242 + fputs(M_ARJDISP_COPYRIGHT, stdout);
244 - scrprintf(M_ARJDISP_DISTRIBUTION);
245 + fputs(M_ARJDISP_DISTRIBUTION, stdout);
247 - scrprintf(M_ARJDISP_LICENSE);
248 + fputs(M_ARJDISP_LICENSE, stdout);
250 scrprintf(M_PROCESSING_ARCHIVE, archive_name);
252 @@ -132,13 +130,13 @@ static void show_proc_scrn()
256 - scrprintf(ind_top);
257 + fputs(ind_top, stdout);
259 - scrprintf(ind_middle);
260 + fputs(ind_middle, stdout);
262 - scrprintf(ind_bottom);
263 + fputs(ind_bottom, stdout);
265 - scrprintf(M_ARJDISP_CTR_START);
266 + fputs(M_ARJDISP_CTR_START, stdout);
270 @@ -146,7 +144,7 @@ static void show_proc_scrn()
272 memset(progress, indo, i);
274 - scrprintf(progress);
275 + fputs(progress, stdout);
277 scrprintf(M_ARJDISP_CTR, calc_percentage(bytes, uncompsize)/10);
279 @@ -165,19 +163,19 @@ static void show_ending_scrn()
283 - scrprintf(win_top);
284 + fputs(win_top, stdout);
287 - gotoxy(2, i); scrprintf(win_border);
288 - gotoxy(79, i); scrprintf(win_border);
289 + gotoxy(2, i); fputs(win_border, stdout);
290 + gotoxy(79, i); fputs(win_border, stdout);
292 - gotoxy(2, 24); scrprintf(win_bottom);
293 + gotoxy(2, 24); fputs(win_bottom, stdout);
295 - scrprintf(M_ARJDISP_COPYRIGHT);
296 + fputs(M_ARJDISP_COPYRIGHT, stdout);
298 - scrprintf(M_ARJDISP_DISTRIBUTION);
299 + fputs(M_ARJDISP_DISTRIBUTION, stdout);
301 - scrprintf(M_ARJDISP_LICENSE);
302 + fputs(M_ARJDISP_LICENSE, stdout);
304 scrprintf(M_FINISHED_PROCESSING, archive_name);