diff --git a/cursor/xcursor.c b/cursor/xcursor.c index 43a5292..6766c56 100644 --- a/cursor/xcursor.c +++ b/cursor/xcursor.c @@ -585,6 +585,7 @@ xcursor_build_fullname(const char *dir, const char *subdir, const char *file) { char *full; size_t full_size; + int ret; if (!dir || !subdir || !file) return NULL; @@ -593,7 +594,11 @@ xcursor_build_fullname(const char *dir, const char *subdir, const char *file) full = malloc(full_size); if (!full) return NULL; - snprintf(full, full_size, "%s/%s/%s", dir, subdir, file); + ret = snprintf(full, full_size, "%s/%s/%s", dir, subdir, file); + if (ret < 0) { + free(full); + return NULL; + } return full; }