diff --git a/vhook/fish.c b/vhook/fish.c
index 0a6418834c2d5563bc5311c7a511e61944711921..c710526b154828899419cf8a4f9080f7ae0fd3a2 100644
--- a/vhook/fish.c
+++ b/vhook/fish.c
@@ -337,7 +337,7 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
                     FILE *f;
                     char fname[256];
 
-                    sprintf(fname, "%s/fishimg%ld_%lld.ppm", ci->dir, time(0), pts);
+                    snprintf(fname, sizeof(fname), "%s/fishimg%ld_%lld.ppm", ci->dir, time(0), pts);
                     f = fopen(fname, "w");
                     if (f) {
                         fprintf(f, "P6 %d %d 255\n", width, height);