1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-04 01:48:54 +00:00
freebsd-ports/graphics/dc20ctrl/files/patch-ad
Kris Kennaway d8f67662da Fix overflows and bump PORTREVISION.
Reviewed by:	jedgar
2001-02-07 20:33:48 +00:00

44 lines
1.2 KiB
Plaintext

diff -ru work/dc20ctrl-0.4/pixmaps.c dc20ctrl-0.4/pixmaps.c
--- work/dc20ctrl-0.4/pixmaps.c Tue Feb 17 09:19:47 1998
+++ pixmaps.c Mon Feb 5 18:42:18 2001
@@ -504,26 +504,32 @@
* Build the image name
*/
- strcpy(fname, name);
- strcat(fname, ".");
+ if (strlcpy(fname, name, sizeof(fname)) >= sizeof(fname))
+ return -1;
+ if (strlcat(fname, ".", sizeof(fname)) >= sizeof(fname))
+ return -1;
switch (format & SAVE_FORMATS) {
#ifdef USE_JPEG
case SAVE_JPEG:
- strcat(fname, JPEG_EXT);
+ if (strlcat(fname, JPEG_EXT, sizeof(fname)) >= sizeof(fname))
+ return -1;
break;
#endif /* USE_JPEG */
#ifdef USE_TIFF
case SAVE_TIFF:
- strcat(fname, TIFF_EXT);
+ if (strlcat(fname, TIFF_EXT, sizeof(fname)) >= sizeof(fname))
+ return -1;
break;
#endif /* USE_TIFF */
#ifdef USE_PNG
case SAVE_PNG:
- strcat(fname, PNG_EXT);
+ if (strlcat(fname, PNG_EXT, sizeof(fname)) >= sizeof(fname))
+ return -1;
break;
#endif /* USE_PNG */
default:
- strcat(fname, (to_be_saved->components == 3) ? PPM_EXT : PGM_EXT );
+ if (strlcat(fname, (to_be_saved->components == 3) ? PPM_EXT : PGM_EXT, sizeof(fname)) >= sizeof(fname))
+ return -1;
break;
}
Only in dc20ctrl-0.4/: rep