aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lutris.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lutris.c b/src/lutris.c
index bd2a2d4..7d663c0 100644
--- a/src/lutris.c
+++ b/src/lutris.c
@@ -34,7 +34,9 @@ COMMAND(lutris, search)
char* str = strdup(argv[1]);
// in the case we need to do replacing we allocate more
// since we'll free in anyway
- size_t allocsize = strlen(str) * 2;
+ // the smallest strlen can return is 0 the longest
+ // escapeString can return is strlen*3
+ size_t allocsize = strlen(str) * 3;
str = realloc(str, allocsize);
lutris_escapeString(str, allocsize);
char* url = malloc(strlen(GAME_SEARCH_API) + strlen(str));
@@ -83,7 +85,9 @@ COMMAND(lutris, list)
char* str = strdup(argv[1]);
// in the case we need to do replacing we allocate more
// since we'll free in anyway
- size_t allocsize = strlen(str) * 2;
+ // the smallest strlen can return is 0 the longest
+ // escapeString can return is strlen*3
+ size_t allocsize = strlen(str) * 3;
str = realloc(str, allocsize);
lutris_escapeString(str, allocsize);
char* url = malloc(strlen(GAME_INSTALLER_API) + strlen(str));