From 76d57382ac30404c761c5f3b4e9bd8e3f3c911eb Mon Sep 17 00:00:00 2001 From: Max Parry <66670928+Buggem@users.noreply.github.com> Date: Fri, 13 Dec 2024 08:03:35 +1100 Subject: [PATCH] Replace `strncpy` with `SDL_strncpy` Co-authored-by: Dav999 --- desktop_version/src/DiscordNetwork.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/desktop_version/src/DiscordNetwork.c b/desktop_version/src/DiscordNetwork.c index 176b79a8..ccc153f5 100644 --- a/desktop_version/src/DiscordNetwork.c +++ b/desktop_version/src/DiscordNetwork.c @@ -144,12 +144,9 @@ void DISCORD_update(const char *level, const char *name) { app.activityMan = app.core->get_activity_manager(app.core); } - strncpy(activity.state, name, 127); - strncpy(activity.assets.large_image, "vvvvvv", 127); - strncpy(activity.assets.large_text, level, 127); - activity.state[127] = '\0'; - activity.assets.large_image[127] = '\0'; - activity.assets.large_text[127] = '\0'; + SDL_strlcpy(activity.state, name, sizeof(activity.state)); + SDL_strlcpy(activity.assets.large_image, "vvvvvv", sizeof(activity.assets.large_image)); + SDL_strlcpy(activity.assets.large_text, level, sizeof(activity.assets.large_text)); app.activityMan->update_activity(app.activityMan, &activity, NULL, NULL);