comparison extensions/app_radgw/rgw_clients.c @ 1442:915450ee91c7

fix gcc 9.1.1 compile warnings Use snprintf instead of strncpy to ensure NUL termination. Simplify attribute copying to calloc/memcpy instead of malloc/memset/strncpy/assignment. Appeases gcc 9.1.1 warnings about strncpy bounds.
author Luke Mewburn <luke@mewburn.net>
date Thu, 27 Feb 2020 16:19:24 +1100
parents 0918e88f7c33
children 566bb46cc73f
comparison
equal deleted inserted replaced
1441:6029afe9bacb 1442:915450ee91c7
761 /* Now check if this alias is valid for this peer */ 761 /* Now check if this alias is valid for this peer */
762 memset(&hint, 0, sizeof(hint)); 762 memset(&hint, 0, sizeof(hint));
763 hint.ai_flags = AI_CANONNAME; 763 hint.ai_flags = AI_CANONNAME;
764 ret = getaddrinfo(buf, NULL, &hint, &res); 764 ret = getaddrinfo(buf, NULL, &hint, &res);
765 if (ret == 0) { 765 if (ret == 0) {
766 strncpy(buf, res->ai_canonname, sizeof(buf)); 766 snprintf(buf, sizeof(buf), "%s", res->ai_canonname);
767 /* The name was resolved correctly, does it match the IP of the client? */ 767 /* The name was resolved correctly, does it match the IP of the client? */
768 for (ptr = res; ptr != NULL; ptr = ptr->ai_next) { 768 for (ptr = res; ptr != NULL; ptr = ptr->ai_next) {
769 if (cli->sa->sa_family != ptr->ai_family) 769 if (cli->sa->sa_family != ptr->ai_family)
770 continue; 770 continue;
771 if (memcmp(cli->sa, ptr->ai_addr, sSAlen(cli->sa))) 771 if (memcmp(cli->sa, ptr->ai_addr, sSAlen(cli->sa)))
"Welcome to our mercurial repository"