comparison src/pst2dii.cpp.in @ 170:0e1e048716e4

fix bug where we failed to pickup the last extended attribute. patch from Emmanuel Andry to fix potential security bug in pst2dii with printf(err).
author Carl Byington <carl@five-ten-sg.com>
date Sun, 22 Mar 2009 14:34:26 -0700
parents 40e9de445038
children 6954d315aaa8
comparison
equal deleted inserted replaced
169:062aa7b7ec22 170:0e1e048716e4
238 char *p; 238 char *p;
239 char *l = xline; 239 char *l = xline;
240 while ((p = strchr(l, '&'))) { 240 while ((p = strchr(l, '&'))) {
241 *p = '\0'; 241 *p = '\0';
242 char *err = gdImageStringFTEx(image, &brect[0], color, font_file, sz, 0.0, x_position, y_position, l, &strex); 242 char *err = gdImageStringFTEx(image, &brect[0], color, font_file, sz, 0.0, x_position, y_position, l, &strex);
243 if (err) printf(err); 243 if (err) printf("%s", err);
244 x_position += (brect[2]-brect[6]); 244 x_position += (brect[2]-brect[6]);
245 l = p+1; 245 l = p+1;
246 err = gdImageStringFTEx(image, &brect[0], color, font_file, sz, 0.0, x_position, y_position, (char*)"&amp;", &strex); 246 err = gdImageStringFTEx(image, &brect[0], color, font_file, sz, 0.0, x_position, y_position, (char*)"&amp;", &strex);
247 if (err) printf(err); 247 if (err) printf("%s", err);
248 x_position += (brect[2]-brect[6]); 248 x_position += (brect[2]-brect[6]);
249 } 249 }
250 char *err = gdImageStringFTEx(image, &brect[0], color, font_file, sz, 0.0, x_position, y_position, l, &strex); 250 char *err = gdImageStringFTEx(image, &brect[0], color, font_file, sz, 0.0, x_position, y_position, l, &strex);
251 if (err) printf(err); 251 if (err) printf("%s", err);
252 x_position += (brect[2]-brect[6]); 252 x_position += (brect[2]-brect[6]);
253 col_number += len; 253 col_number += len;
254 } 254 }
255 255
256 256
329 strex.hdpi = DPI; 329 strex.hdpi = DPI;
330 strex.vdpi = DPI; 330 strex.vdpi = DPI;
331 331
332 char line[LINE_SIZE]; 332 char line[LINE_SIZE];
333 char *err = gdImageStringFTEx(NULL, &brect[0], black, font_file, sz, 0.0, margin, margin, (char*)"LMgqQ", &strex); 333 char *err = gdImageStringFTEx(NULL, &brect[0], black, font_file, sz, 0.0, margin, margin, (char*)"LMgqQ", &strex);
334 if (err) printf(err); 334 if (err) printf("%s", err);
335 line_height = (brect[3]-brect[7]) * 12/10; 335 line_height = (brect[3]-brect[7]) * 12/10;
336 char_width = (brect[2]-brect[6]) / 5; 336 char_width = (brect[2]-brect[6]) / 5;
337 col_number = 0; 337 col_number = 0;
338 col_max = (PAGE_WIDTH - margin*2) / char_width; 338 col_max = (PAGE_WIDTH - margin*2) / char_width;
339 line_number = 0; 339 line_number = 0;