Increase the allowable node name length from 24 to 256.

Enable safe copying, no user induced buffer overflow.
This commit is contained in:
Holger Vogt 2023-11-18 10:55:19 +01:00
parent 10756111bf
commit b62bb20e6f
3 changed files with 5 additions and 3 deletions

View File

@ -184,7 +184,7 @@ typedef struct linked_lists_of_Bpoint{
} BPOINT, *BPOINTPTR;
typedef struct linked_lists_of_nodeName{
char id[24];
char id[256];
struct linked_lists_of_nodeName *left, *right;
NODE *nd;
} NDname, *NDnamePt;

View File

@ -1934,7 +1934,8 @@ insert_ND(char* name, NDnamePt* ndn)
memsaved(p);
p->nd = NULL;
p->right = p->left = NULL;
strcpy(p->id, name);
strncpy(p->id, name, 255);
p->id[255] = '\0';
return(p);
}
cmp = strcmp((*ndn)->id, name);

View File

@ -1035,7 +1035,8 @@ insert_ND(char *name, NDnamePt *ndn)
p = *ndn = TMALLOC(NDname, 1);
p->nd = NULL;
p->right = p->left = NULL;
strcpy(p->id, name);
strncpy(p->id, name, 255);
p->id[255] = '\0';
return(p);
}
cmp = strcmp((*ndn)->id, name);