From a2615d01a7a2d366af969bfd04f29aa06f48ecd1 Mon Sep 17 00:00:00 2001 From: depsterr Date: Sun, 7 Mar 2021 19:13:01 +0100 Subject: [PATCH] fix segfault in is image name --- mpdart.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mpdart.c b/mpdart.c index 5686b08..4e2208b 100644 --- a/mpdart.c +++ b/mpdart.c @@ -90,9 +90,13 @@ void* xrealloc(void* ptr, size_t size) { /* this fucks up if you name a folder .jpg or .png, but at that point you had it coming */ int is_image_name(char* f) { char* extension = strrchr(f, '.'); + if (!extension) { + return 0; + } for (int n = 0; image_extensions[n]; n++) { - if (!strcmp(extension, image_extensions[n])) + if (!strcmp(extension, image_extensions[n])) { return 1; + } } return 0; }