1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-12 11:11:52 +00:00

control null terminated string copying

This commit is contained in:
Alberto Fanjul 2024-07-13 19:14:55 +02:00
parent c9c8bd7a7a
commit 937747fd4d
2 changed files with 3 additions and 2 deletions

View file

@ -1054,7 +1054,7 @@ static int wpas__bind_server_socket(int fd, const char *ctrl_path, char *name)
}
}
strncpy(name, src.sun_path, UNIX_PATH_MAX - 1);
strncpy(name, src.sun_path, UNIX_PATH_MAX);
name[UNIX_PATH_MAX - 1] = 0;
return 0;

View file

@ -61,7 +61,8 @@ int peer_new(struct link *l,
r = log_ENOMEM();
goto error;
}
strncpy(p->p2p_mac, mac, MAC_STRLEN - 1);
strncpy(p->p2p_mac, mac, MAC_STRLEN);
p->p2p_mac[MAC_STRLEN - 1] = 0;
r = shl_htable_insert_str(&l->peers, &p->p2p_mac, NULL);
if (r < 0) {