lib

morphux C utility library
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/lib

commit abb7eab672d2bb7784f5ef069dc32fa0df1cc5c5
parent 310b60ba10379a051e82ce43c721baff552060a7
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 23 Jan 2017 20:48:47 +0100

Fix(minfos): Now checking string length before copy

Diffstat:
Msrc/m_infos.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/m_infos.c b/src/m_infos.c @@ -28,7 +28,7 @@ static char maintainer[INFOS_G_LEN_MAX] = ""; void set_program_name(const char *str) { if (str == NULL) { strcpy(program, ""); - } else { + } else if (strlen(str) < INFOS_G_LEN_MAX) { strcpy(program, str); } } @@ -39,7 +39,7 @@ void set_program_name(const char *str) { void set_version(const char *str) { if (str == NULL) { strcpy(version, ""); - } else { + } else if (strlen(str) < INFOS_G_LEN_MAX) { strcpy(version, str); } } @@ -50,7 +50,7 @@ void set_version(const char *str) { void set_maintainer(const char *str) { if (str == NULL) { strcpy(maintainer, ""); - } else { + } else if (strlen(str) < INFOS_G_LEN_MAX) { strcpy(maintainer, str); } }