fix: possible overrun

This commit is contained in:
iceman1001 2019-02-24 21:42:30 +01:00
commit f59e67c00c

View file

@ -237,10 +237,13 @@ static char *asn1_oid_description(const char *oid, bool with_group_desc) {
static char res[300];
memset(res, 0x00, sizeof(res));
strcpy(fname, get_my_executable_directory());
size_t len = strlen(get_my_executable_directory());
if ( len > 300 ) len = 299;
strncpy(fname, get_my_executable_directory(), len);
strcat(fname, "crypto/oids.json");
if (access(fname, F_OK) < 0) {
strcpy(fname, get_my_executable_directory());
strncpy(fname, get_my_executable_directory(), len);
strcat(fname, "oids.json");
if (access(fname, F_OK) < 0) {
goto error; // file not found