$OpenBSD: patch-src_main_c,v 1.2 2011/07/08 11:25:47 jasper Exp $ --- src/main.c.orig Mon Jun 23 14:05:48 2003 +++ src/main.c Fri Jul 8 13:22:30 2011 @@ -426,28 +426,28 @@ im_printf(char *str, struct tm *tm, switch (*c) { case 'f': if (filename_im) - strcat(ret, filename_im); + strlcat(ret, filename_im, sizeof(ret)); break; case 'm': /* t was allready taken, so m as in mini */ if (filename_thumb) - strcat(ret, filename_thumb); + strlcat(ret, filename_thumb, sizeof(ret)); break; case 'n': if (filename_im) { tmp = strrchr(filename_im, '/'); if (tmp) - strcat(ret, tmp + 1); + strlcat(ret, tmp + 1, sizeof(ret)); else - strcat(ret, filename_im); + strlcat(ret, filename_im, sizeof(ret)); } break; case 'w': snprintf(buf, sizeof(buf), "%d", gib_imlib_image_get_width(im)); - strcat(ret, buf); + strlcat(ret, buf, sizeof(ret)); break; case 'h': snprintf(buf, sizeof(buf), "%d", gib_imlib_image_get_height(im)); - strcat(ret, buf); + strlcat(ret, buf, sizeof(ret)); break; case 's': if (filename_im) { @@ -456,22 +456,22 @@ im_printf(char *str, struct tm *tm, size = st.st_size; snprintf(buf, sizeof(buf), "%d", size); - strcat(ret, buf); + strlcat(ret, buf, sizeof(ret)); } else - strcat(ret, "[err]"); + strlcat(ret, "[err]", sizeof(ret)); } break; case 'p': snprintf(buf, sizeof(buf), "%d", gib_imlib_image_get_width(im) * gib_imlib_image_get_height(im)); - strcat(ret, buf); + strlcat(ret, buf, sizeof(ret)); break; case 't': - strcat(ret, gib_imlib_image_format(im)); + strlcat(ret, gib_imlib_image_format(im), sizeof(ret)); break; case '$': - strcat(ret, "$"); + strlcat(ret, "$", sizeof(ret)); break; default: strncat(ret, c, 1); @@ -482,7 +482,7 @@ im_printf(char *str, struct tm *tm, switch (*c) { case 'n': if (filename_im) - strcat(ret, "\n"); + strlcat(ret, "\n", sizeof(ret)); break; default: strncat(ret, c, 1);