From: Alan T. DeKok Date: Tue, 6 Apr 2021 12:35:02 +0000 (-0400) Subject: declare 'key' as const, which avoids a weird memcpy X-Git-Tag: release_3_0_24~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74439e6f017e921d73d79209b1acb3434b1b8a77;p=thirdparty%2Ffreeradius-server.git declare 'key' as const, which avoids a weird memcpy --- diff --git a/src/main/listen.c b/src/main/listen.c index 724cae1040c..bc0b2a3fe91 100644 --- a/src/main/listen.c +++ b/src/main/listen.c @@ -3722,7 +3722,7 @@ rad_listen_t *listener_find_byipaddr(fr_ipaddr_t const *ipaddr, uint16_t port, i static rbtree_t *coa_tree = NULL; typedef struct { - char *key; + char const *key; rad_listen_t *first; pthread_mutex_t mutex; /* per key, to lower contention */ @@ -3788,7 +3788,7 @@ void listen_coa_add(rad_listen_t *this, char const *key) /* * Find the key. If we can't find it, then create it. */ - memcpy(&my_key.key, &key, sizeof(key)); /* const issues */ + my_key.key = key; retry: coa_key = rbtree_finddata(coa_tree, &my_key);