Skip to content

Commit e3b0df4

Browse files
author
Tomasz Kazimierz Motyl
committed
strncpy instead of strcpy
1 parent b04bd95 commit e3b0df4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bacnet/hostnport.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,8 @@ bool bacnet_is_valid_hostname(const BACNET_CHARACTER_STRING *const hostname)
12181218
{
12191219
char fqdn_copy[MAX_CHARACTER_STRING_BYTES + 1];
12201220
char *label = NULL;
1221-
strcpy(fqdn_copy, val); /* Make a copy to manipulate */
1221+
1222+
strncpy(fqdn_copy, vali, sizeof(fqdn_copy) - 1); /* Make a copy to manipulate */
12221223

12231224
label = strtok(fqdn_copy, "."); /* Split FQDN by '.' */
12241225

0 commit comments

Comments
 (0)