# sdl2-compat: OS\_GetExeName, linux: change strlcpy into an snprintf for compatibility

**URL:** <https://discourse.libsdl.org/t/sdl2-compat-os-getexename-linux-change-strlcpy-into-an-snprintf-for-compatibility/57893>\
**Category:** SDL Commits\
**Created:** [February 13, 2025, 7:14pm UTC](https://discourse.libsdl.org/t/sdl2-compat-os-getexename-linux-change-strlcpy-into-an-snprintf-for-compatibility/57893 "2025-02-13T19:14:57Z")\
**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:** [February 13, 2025, 7:14pm UTC](https://discourse.libsdl.org/t/sdl2-compat-os-getexename-linux-change-strlcpy-into-an-snprintf-for-compatibility/57893/1 "2025-02-13T19:14:57Z")

</div>

> <https://github.com/libsdl-org/sdl2-compat/commit/e81b15f187400191da89a9270ed50f4eb9706f6a>

```diff
From e81b15f187400191da89a9270ed50f4eb9706f6a Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Thu, 13 Feb 2025 22:14:50 +0300
Subject: [PATCH] OS_GetExeName, linux: change strlcpy into an snprintf for
 compatibility

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

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 1099129..fbb5d4b 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -502,7 +502,7 @@ static void OS_GetExeName(char *buf, const unsigned maxpath, bool *use_base_path
                         }
                         spot = sep;
                     }
- strlcpy(buf, spot, maxpath);
+ snprintf(buf, maxpath, "%s", spot);
                 }
                 *use_base_path = false;
             }

```
