Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 108365 | Differences between
and this patch

Collapse All | Expand All

(-)xloadimage.4.1.orig/config.c (-10 / +11 lines)
Lines 313-324 Link Here
313
 * -1 if access denied or not found, 0 if ok.
313
 * -1 if access denied or not found, 0 if ok.
314
 */
314
 */
315
315
316
int findImage(name, fullname)
316
int findImage(name, fullname, size)
317
     char *name, *fullname;
317
     char *name, *fullname;
318
     size_t size;
318
{ unsigned int   p, e;
319
{ unsigned int   p, e;
319
  struct stat    sbuf;
320
  struct stat    sbuf;
320
321
321
  strcpy(fullname, name);
322
  strncpy(fullname, name, size);
322
  if (!strcmp(name, "stdin")) /* stdin is special name */
323
  if (!strcmp(name, "stdin")) /* stdin is special name */
323
    return(0);
324
    return(0);
324
325
Lines 327-333 Link Here
327
  if (! stat(fullname, &sbuf))
328
  if (! stat(fullname, &sbuf))
328
      return(fileIsOk(fullname, &sbuf));
329
      return(fileIsOk(fullname, &sbuf));
329
#ifndef NO_COMPRESS
330
#ifndef NO_COMPRESS
330
  strcat(fullname, ".Z");
331
  strncat(fullname, ".Z", size);
331
  if (! stat(fullname, &sbuf))
332
  if (! stat(fullname, &sbuf))
332
      return(fileIsOk(fullname, &sbuf));
333
      return(fileIsOk(fullname, &sbuf));
333
#endif
334
#endif
Lines 336-347 Link Here
336
#ifdef VMS
337
#ifdef VMS
337
    sprintf(fullname, "%s%s", Paths[p], name);
338
    sprintf(fullname, "%s%s", Paths[p], name);
338
#else
339
#else
339
    sprintf(fullname, "%s/%s", Paths[p], name);
340
    snprintf(fullname, size, "%s/%s", Paths[p], name);
340
#endif
341
#endif
341
    if (! stat(fullname, &sbuf))
342
    if (! stat(fullname, &sbuf))
342
      return(fileIsOk(fullname, &sbuf));
343
      return(fileIsOk(fullname, &sbuf));
343
#ifndef NO_COMPRESS
344
#ifndef NO_COMPRESS
344
    strcat(fullname, ".Z");
345
    strncat(fullname, ".Z", size);
345
    if (! stat(fullname, &sbuf))
346
    if (! stat(fullname, &sbuf))
346
#endif
347
#endif
347
      return(fileIsOk(fullname, &sbuf));
348
      return(fileIsOk(fullname, &sbuf));
Lines 349-360 Link Here
349
#ifdef VMS
350
#ifdef VMS
350
      sprintf(fullname, "%s%s%s", Paths[p], name, Exts[e]);
351
      sprintf(fullname, "%s%s%s", Paths[p], name, Exts[e]);
351
#else
352
#else
352
      sprintf(fullname, "%s/%s%s", Paths[p], name, Exts[e]);
353
      snprintf(fullname, size, "%s/%s%s", Paths[p], name, Exts[e]);
353
#endif
354
#endif
354
      if (! stat(fullname, &sbuf))
355
      if (! stat(fullname, &sbuf))
355
	return(fileIsOk(fullname, &sbuf));
356
	return(fileIsOk(fullname, &sbuf));
356
#ifndef NO_COMPRESS
357
#ifndef NO_COMPRESS
357
      strcat(fullname, ".Z");
358
      strncat(fullname, ".Z", size);
358
      if (! stat(fullname, &sbuf))
359
      if (! stat(fullname, &sbuf))
359
	return(fileIsOk(fullname, &sbuf));
360
	return(fileIsOk(fullname, &sbuf));
360
#endif
361
#endif
Lines 362-372 Link Here
362
  }
363
  }
363
364
364
  for (e= 0; e < NumExts; e++) {
365
  for (e= 0; e < NumExts; e++) {
365
    sprintf(fullname, "%s%s", name, Exts[e]);
366
    snprintf(fullname, size, "%s%s", name, Exts[e]);
366
    if (! stat(fullname, &sbuf))
367
    if (! stat(fullname, &sbuf))
367
      return(fileIsOk(fullname, &sbuf));
368
      return(fileIsOk(fullname, &sbuf));
368
#ifndef NO_COMPRESS
369
#ifndef NO_COMPRESS
369
    strcat(fullname, ".Z");
370
    strncat(fullname, ".Z", size);
370
    if (! stat(fullname, &sbuf))
371
    if (! stat(fullname, &sbuf))
371
      return(fileIsOk(fullname, &sbuf));
372
      return(fileIsOk(fullname, &sbuf));
372
#endif
373
#endif
Lines 392-398 Link Here
392
#ifdef VMS
393
#ifdef VMS
393
    sprintf(buf, "directory %s", Paths[a]);
394
    sprintf(buf, "directory %s", Paths[a]);
394
#else
395
#else
395
    sprintf(buf, "ls %s", Paths[a]);
396
    snprintf(buf, sizeof(buf)-1, "ls %s", Paths[a]);
396
#endif
397
#endif
397
    if (system(buf) < 0) {
398
    if (system(buf) < 0) {
398
#ifdef VMS
399
#ifdef VMS
(-)xloadimage.4.1.orig/imagetypes.c (-3 / +3 lines)
Lines 17-23 Link Here
17
/* SUPPRESS 560 */
17
/* SUPPRESS 560 */
18
18
19
extern int errno;
19
extern int errno;
20
extern int findImage(char *name, char *fullname);
20
extern int findImage(char *name, char *fullname, size_t size);
21
21
22
/* load a named image
22
/* load a named image
23
 */
23
 */
Lines 32-38 Link Here
32
  Image  *image;
32
  Image  *image;
33
  int     a;
33
  int     a;
34
34
35
  if (findImage(name, fullname) < 0) {
35
  if (findImage(name, fullname, BUFSIZ) < 0) {
36
    if (errno == ENOENT)
36
    if (errno == ENOENT)
37
      fprintf(stderr, "%s: image not found\n", name);
37
      fprintf(stderr, "%s: image not found\n", name);
38
    else
38
    else
Lines 109-115 Link Here
109
{ char fullname[BUFSIZ];
109
{ char fullname[BUFSIZ];
110
  int  a;
110
  int  a;
111
111
112
  if (findImage(name, fullname) < 0) {
112
  if (findImage(name, fullname, BUFSIZ) < 0) {
113
    if (errno == ENOENT)
113
    if (errno == ENOENT)
114
      fprintf(stderr, "%s: image not found\n", name);
114
      fprintf(stderr, "%s: image not found\n", name);
115
    else
115
    else
(-)xloadimage.4.1.orig/jpeg.c (-1 / +1 lines)
Lines 19-25 Link Here
19
#undef  debug
19
#undef  debug
20
20
21
#ifdef DEBUG
21
#ifdef DEBUG
22
# define debug(xx)	fprintf(stderr,xx)
22
# define debug(xx)	fprintf(stderr, "%s", xx)
23
#else
23
#else
24
# define debug(xx)
24
# define debug(xx)
25
#endif
25
#endif
(-)xloadimage.4.1.orig/mcidas.c (-1 / +1 lines)
Lines 63-69 Link Here
63
  minute = (time % 10000) / 100;
63
  minute = (time % 10000) / 100;
64
  second = (time % 100);
64
  second = (time % 100);
65
65
66
  sprintf(buf, "%d:%2.2d:%2.2d %s %d, %d (day %d)",
66
  snprintf(buf, 29, "%d:%2.2d:%2.2d %s %d, %d (day %d)",
67
	  hour, minute, second, month_info[month].name, day, year,
67
	  hour, minute, second, month_info[month].name, day, year,
68
	  (date % 1000));
68
	  (date % 1000));
69
  return(buf);
69
  return(buf);
(-)xloadimage.4.1.orig/png.c (-1 / +1 lines)
Lines 30-36 Link Here
30
#undef  debug
30
#undef  debug
31
31
32
#ifdef DEBUG
32
#ifdef DEBUG
33
# define debug(xx)	fprintf(stderr,xx)
33
# define debug(xx)	fprintf(stderr, "%s", xx)
34
#else
34
#else
35
# define debug(xx)
35
# define debug(xx)
36
#endif
36
#endif
(-)xloadimage.4.1.orig/reduce.c (-1 / +1 lines)
Lines 502-508 Link Here
502
502
503
  depth= colorsToDepth(n);
503
  depth= colorsToDepth(n);
504
  new_image= newRGBImage(image->width, image->height, depth);
504
  new_image= newRGBImage(image->width, image->height, depth);
505
  sprintf(buf, "%s (%d colors)", image->title, n);
505
  snprintf(buf, BUFSIZ - 1, "%s (%d colors)", image->title, n);
506
  new_image->title= dupString(buf);
506
  new_image->title= dupString(buf);
507
507
508
  /* calculate RGB table from each color area.  this should really calculate
508
  /* calculate RGB table from each color area.  this should really calculate
(-)xloadimage.4.1.orig/rle.c (-1 / +1 lines)
Lines 21-27 Link Here
21
#undef  debug
21
#undef  debug
22
22
23
#ifdef DEBUG
23
#ifdef DEBUG
24
# define debug(xx)	fprintf(stderr,xx)
24
# define debug(xx)	fprintf(stderr, "%s", xx)
25
#else
25
#else
26
# define debug(xx)
26
# define debug(xx)
27
#endif
27
#endif
(-)xloadimage.4.1.orig/rotate.c (-1 / +1 lines)
Lines 70-76 Link Here
70
    { printf("  Rotating image by %d degrees...", degrees);
70
    { printf("  Rotating image by %d degrees...", degrees);
71
      fflush(stdout);
71
      fflush(stdout);
72
    }
72
    }
73
  sprintf(buf, "%s (rotated by %d degrees)", simage->title, degrees);
73
  snprintf(buf, BUFSIZ - 1, "%s (rotated by %d degrees)", simage->title, degrees);
74
74
75
  image1 = simage;
75
  image1 = simage;
76
  image2 = NULL;
76
  image2 = NULL;
(-)xloadimage.4.1.orig/tiff.c (-2 / +2 lines)
Lines 133-146 Link Here
133
  switch (info->photometric) {
133
  switch (info->photometric) {
134
  case PHOTOMETRIC_MINISBLACK:
134
  case PHOTOMETRIC_MINISBLACK:
135
    if (info->bitspersample > 1) {
135
    if (info->bitspersample > 1) {
136
      sprintf(buf, "%d-bit greyscale ", info->bitspersample);
136
      snprintf(buf, 31, "%d-bit greyscale ", info->bitspersample);
137
      return(buf);
137
      return(buf);
138
    }
138
    }
139
    else
139
    else
140
      return "white-on-black ";
140
      return "white-on-black ";
141
  case PHOTOMETRIC_MINISWHITE:
141
  case PHOTOMETRIC_MINISWHITE:
142
    if (info->bitspersample > 1) {
142
    if (info->bitspersample > 1) {
143
      sprintf(buf, "%d-bit greyscale ", info->bitspersample);
143
      snprintf(buf, 31, "%d-bit greyscale ", info->bitspersample);
144
      return(buf);
144
      return(buf);
145
    }
145
    }
146
    else
146
    else
(-)xloadimage.4.1.orig/window.c (-1 / +1 lines)
Lines 606-612 Link Here
606
  else {
606
  else {
607
    char def_geom[30];
607
    char def_geom[30];
608
608
609
    sprintf(def_geom, "%ux%u+0+0", image->width, image->height);
609
    snprintf(def_geom, 29, "%ux%u+0+0", image->width, image->height);
610
    XGeometry(disp, scrn, opt->info.geometry.string, def_geom, 0, 1, 1, 0, 0,
610
    XGeometry(disp, scrn, opt->info.geometry.string, def_geom, 0, 1, 1, 0, 0,
611
	      (int *)&winx, (int *)&winy, (int *)&winwidth, (int *)&winheight);
611
	      (int *)&winx, (int *)&winy, (int *)&winwidth, (int *)&winheight);
612
  }
612
  }
(-)xloadimage.4.1.orig/zio.c (-1 / +1 lines)
Lines 233-239 Link Here
233
            strcpy (s, "'");
233
            strcpy (s, "'");
234
            debug(("Filtering image through '%s'\n", filter->filter));
234
            debug(("Filtering image through '%s'\n", filter->filter));
235
            zf->type= ZPIPE;
235
            zf->type= ZPIPE;
236
            sprintf(buf, "%s %s", filter->filter, fname);
236
            snprintf(buf, BUFSIZ - 1, "%s %s", filter->filter, fname);
237
            lfree (fname);
237
            lfree (fname);
238
      if (! (zf->stream= popen(buf, "r"))) {
238
      if (! (zf->stream= popen(buf, "r"))) {
239
	lfree((byte *)zf->filename);
239
	lfree((byte *)zf->filename);
(-)xloadimage.4.1.orig/zoom.c (-4 / +4 lines)
Lines 63-85 Link Here
63
  if (!xzoom) {
63
  if (!xzoom) {
64
    if (verbose)
64
    if (verbose)
65
      printf("  Zooming image Y axis by %d%%...", yzoom);
65
      printf("  Zooming image Y axis by %d%%...", yzoom);
66
      sprintf(buf, "%s (Y zoom %d%%)", oimage->title, yzoom);
66
      snprintf(buf, BUFSIZ - 1, "%s (Y zoom %d%%)", oimage->title, yzoom);
67
  }
67
  }
68
  else if (!yzoom) {
68
  else if (!yzoom) {
69
    if (verbose)
69
    if (verbose)
70
      printf("  Zooming image X axis by %d%%...", xzoom);
70
      printf("  Zooming image X axis by %d%%...", xzoom);
71
    sprintf(buf, "%s (X zoom %d%%)", oimage->title, xzoom);
71
    snprintf(buf, BUFSIZ - 1, "%s (X zoom %d%%)", oimage->title, xzoom);
72
  }
72
  }
73
  else if (xzoom == yzoom) {
73
  else if (xzoom == yzoom) {
74
    if (verbose)
74
    if (verbose)
75
      printf("  Zooming image by %d%%...", xzoom);
75
      printf("  Zooming image by %d%%...", xzoom);
76
    sprintf(buf, "%s (%d%% zoom)", oimage->title, xzoom);
76
    snprintf(buf, BUFSIZ - 1, "%s (%d%% zoom)", oimage->title, xzoom);
77
  }
77
  }
78
  else {
78
  else {
79
    if (verbose)
79
    if (verbose)
80
      printf("  Zooming image X axis by %d%% and Y axis by %d%%...",
80
      printf("  Zooming image X axis by %d%% and Y axis by %d%%...",
81
	     xzoom, yzoom);
81
	     xzoom, yzoom);
82
    sprintf(buf, "%s (X zoom %d%% Y zoom %d%%)", oimage->title,
82
    snprintf(buf, BUFSIZ - 1, "%s (X zoom %d%% Y zoom %d%%)", oimage->title,
83
	    xzoom, yzoom);
83
	    xzoom, yzoom);
84
  }
84
  }
85
  if (verbose)
85
  if (verbose)

Return to bug 108365