From f3d39815e7f0f80ae7aa2ec6e069f0679a4610cc Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Sun, 9 Nov 2025 16:51:37 -0500
Subject: [PATCH] progressbar: Ensure buffers are large enough for string
manipulation
---
src/core/linux/SDL_progressbar.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/core/linux/SDL_progressbar.c b/src/core/linux/SDL_progressbar.c
index 9f98e6acfd69a..6bced6efed461 100644
--- a/src/core/linux/SDL_progressbar.c
+++ b/src/core/linux/SDL_progressbar.c
@@ -49,17 +49,23 @@ static char *GetDBUSObjectPath(void)
// Ensure it starts with a letter or underscore
if (!SDL_isalpha(app_id[0]) && app_id[0] != '_') {
+ app_id = SDL_realloc(app_id, SDL_strlen(app_id) + 2);
+ if (!app_id) {
+ return NULL;
+ }
SDL_memmove(app_id + 1, app_id, SDL_strlen(app_id) + 1);
app_id[0] = '_';
}
// Create full path
- char path[1024];
- SDL_snprintf(path, sizeof(path), "/org/libsdl/%s_%d", app_id, getpid());
+ char *path;
+ if (SDL_asprintf(&path, "/org/libsdl/%s_%d", app_id, getpid()) < 0) {
+ path = NULL;
+ }
SDL_free(app_id);
- return SDL_strdup(path);
+ return path;
}
static char *GetAppDesktopPath(void)