diff --git a/enum_functions.c b/enum_functions.c index 63e1195..0732a83 100644 --- a/enum_functions.c +++ b/enum_functions.c @@ -9,7 +9,7 @@ void enumtostr(char *scode, int code) char line[128]; FILE *fp; int bytes = 0; - + snprintf(scode, 10, "%d", code); fp = fopen("/usr/lib/rmps/resources/enum_codes", "r"); @@ -20,13 +20,13 @@ void enumtostr(char *scode, int code) while (fgets(line, sizeof(line), fp) != NULL) if (strstr(line, scode) != NULL) { char *byte; + bytes = sprintf(scode, "%s", line); byte = memchr(scode, '\n', bytes); byte[-1] = '\0'; break; } - strncpy(scode, (char*)memchr(scode, '\"', bytes) + 1, bytes); + strncpy(scode, (char *)memchr(scode, '\"', bytes) + 1, bytes); fclose(fp); - return; }