# SDL: dialog: Allocate space for terminator when building filter string

**URL:** <https://discourse.libsdl.org/t/sdl-dialog-allocate-space-for-terminator-when-building-filter-string/50543>\
**Category:** SDL Commits\
**Created:** [April 16, 2024, 9:10pm UTC](https://discourse.libsdl.org/t/sdl-dialog-allocate-space-for-terminator-when-building-filter-string/50543 "2024-04-16T21:10:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [April 16, 2024, 9:10pm UTC](https://discourse.libsdl.org/t/sdl-dialog-allocate-space-for-terminator-when-building-filter-string/50543/1 "2024-04-16T21:10:03Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/65a04a772e30a51047bca05ebee9e3bb82b04a2b>

```diff
From 65a04a772e30a51047bca05ebee9e3bb82b04a2b Mon Sep 17 00:00:00 2001
From: DevonArtmeier <[EMAIL REDACTED]>
Date: Tue, 16 Apr 2024 17:02:27 -0400
Subject: [PATCH] dialog: Allocate space for terminator when building filter
 string

---
 src/dialog/SDL_dialog_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dialog/SDL_dialog_utils.c b/src/dialog/SDL_dialog_utils.c
index 865821c8ccf20..962ec02fc1d05 100644
--- a/src/dialog/SDL_dialog_utils.c
+++ b/src/dialog/SDL_dialog_utils.c
@@ -54,7 +54,7 @@ char *convert_filters(const SDL_DialogFileFilter *filters, NameTransform ntf,
 
         terminator = f[1].name ? separator : suffix;
         new_length = SDL_strlen(combined) + SDL_strlen(converted)
- + SDL_strlen(terminator);
+ + SDL_strlen(terminator) + 1;
 
         new_combined = SDL_realloc(combined, new_length);
 

```
