diff --git a/src/wallpaper.c b/src/wallpaper.c index 8a2a979411b7f24fa8a11f8450e50de7131add16..930e52e95e73032dc557694cb468d2019a03c95a 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -278,7 +278,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, filbuf[out++] = '\''; } else { - for (l = filelist; l; l = l->next) { + for (l = filelist; l && out < 4092; l = l->next) { filbuf[out++] = '\''; fil = FEH_FILE(l->data)->filename;