--- ddxli.h +++ ddxli.h @@ -36,11 +36,13 @@ /* equate bcopy with memcpy and bzero with memset where appropriate. */ #ifdef HAS_MEMCPY +#ifndef __linux__ #ifndef bcopy #define bcopy(S,D,N) memcpy((char *)(D),(char *)(S),(N)) #endif #ifndef bzero #define bzero(P,N) memset((P),'\0',(N)) +#endif /* __linux__ */ #endif #ifndef bfill #define bfill(P,N,C) memset((P),(C),(N)) --- faces.c +++ faces.c @@ -56,9 +56,15 @@ if (! strcmp(buf, "\n")) break; if (!strncmp(buf, "FirstName:", 10)) - strcpy(fname, buf + 11); + { + strncpy(fname, buf + 11, BUFSIZ - 1); + fname[BUFSIZ - 1] = '\0'; + } else if (!strncmp(buf, "LastName:", 9)) - strcpy(lname, buf + 10); + { + strncpy(lname, buf + 10, BUFSIZ - 1); + lname[BUFSIZ - 1] = '\0'; + } else if (!strncmp(buf, "Image:", 6)) { if (sscanf(buf + 7, "%d%d%d", &iw, &ih, &id) != 3) { fprintf(stderr,"facesLoad: %s - Bad image\n", name); --- reduce.c +++ reduce.c @@ -178,7 +178,8 @@ /* get destination image */ depth = colorsToDepth(OutColors); new_image = newRGBImage(image->width, image->height, depth); - sprintf(buf, "%s (%d colors)", image->title, OutColors); + snprintf(buf, BUFSIZ, "%s (%d colors)", image->title, OutColors); + buf[BUFSIZ-1] = '\0'; new_image->title = dupString(buf); new_image->gamma = image->gamma; --- zoom.c +++ zoom.c @@ -52,28 +52,29 @@ if (verbose) printf(" Zooming image Y axis by %d%%...", yzoom); if (changetitle) - sprintf(buf, "%s (Y zoom %d%%)", oimage->title, yzoom); + snprintf(buf, BUFSIZ, "%s (Y zoom %d%%)", oimage->title, yzoom); } else if (!yzoom) { if (verbose) printf(" Zooming image X axis by %d%%...", xzoom); if (changetitle) - sprintf(buf, "%s (X zoom %d%%)", oimage->title, xzoom); + snprintf(buf, BUFSIZ, "%s (X zoom %d%%)", oimage->title, xzoom); } else if (xzoom == yzoom) { if (verbose) printf(" Zooming image by %d%%...", xzoom); if (changetitle) - sprintf(buf, "%s (%d%% zoom)", oimage->title, xzoom); + snprintf(buf, BUFSIZ, "%s (%d%% zoom)", oimage->title, xzoom); } else { if (verbose) printf(" Zooming image X axis by %d%% and Y axis by %d%%...", xzoom, yzoom); if (changetitle) - sprintf(buf, "%s (X zoom %d%% Y zoom %d%%)", oimage->title, + snprintf(buf, BUFSIZ, "%s (X zoom %d%% Y zoom %d%%)", oimage->title, xzoom, yzoom); } + buf[BUFSIZ-1] = '\0'; if (!changetitle) strcpy(buf,oimage->title);