Fix three network-related warnings.

This commit is contained in:
OBattler
2025-09-22 05:18:04 +02:00
parent 151c3d8730
commit b81dee7998
3 changed files with 4 additions and 1 deletions

View File

@@ -401,6 +401,7 @@ net_netswitch_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, c
memcpy(ns_args.mac_addr, net_netswitch->mac_addr, 6);
/* The remote switch hostname */
strncpy(ns_args.nrs_hostname, netcard->nrs_hostname, sizeof(ns_args.nrs_hostname) - 1);
ns_args.nrs_hostname[127] = 0x00;
net_switch_log("%s Net Switch: Starting up virtual switch with group %d, flags %d\n", net_netswitch->switch_type, ns_args.group, ns_args.flags);

View File

@@ -242,6 +242,7 @@ ns_open(struct ns_open_args *open_args) {
/* Remote switch hostname */
strncpy(conn->nrs_hostname, open_args->nrs_hostname, sizeof(conn->nrs_hostname) - 1);
conn->nrs_hostname[127] = 0x00;
/* Switch type */
if(conn->switch_type == SWITCH_TYPE_REMOTE) {

View File

@@ -53,7 +53,8 @@ static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, si
{
pb_byte_t *dest = (pb_byte_t*)stream->state;
stream->state = dest + count;
if ((dest != NULL) && (buf != NULL))
memcpy(dest, buf, count * sizeof(pb_byte_t));
return true;