Skip to content

Commit 3f05c8b

Browse files
committed
mdns: suppress a Coverity warning
Coverity: CID 739612 (#1 of 1): Buffer not null terminated (BUFFER_SIZE) At (5): Calling strncpy with a source string whose length (4 chars) is greater than or equal to the size argument (4) will fail to null-terminate "hello->head". Signed-off-by: Ferry Huberts <[email protected]>
1 parent d6aff7a commit 3f05c8b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/mdns/src/RouterElection.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void initTimer (void *foo __attribute__ ((unused))){
200200
memcpy(&ROUTER_ID, &olsr_cnf->main_addr, sizeof(union olsr_ip_addr));
201201
hello = (struct RtElHelloPkt *) malloc(sizeof(struct RtElHelloPkt));
202202
OLSR_PRINTF(1,"initialization running step 1\n");
203-
strncpy(hello->head, "$REP", 4);
203+
memcpy(hello->head, "$REP", 4);
204204
if(olsr_cnf->ip_version == AF_INET)
205205
hello->ipFamily = AF_INET;
206206
else

0 commit comments

Comments
 (0)