simplify use of sockaddr* structs to work around buffer overflow warning
Этот коммит содержится в:
родитель
8f4e1133cd
Коммит
6bfaa925ec
@ -221,7 +221,7 @@ static void accept_connection(const int accepted_fd,
|
||||
static int parse_uri(const uint16_t af_family,
|
||||
const char* host,
|
||||
const char *port,
|
||||
struct sockaddr* inaddr)
|
||||
struct sockaddr_storage* inaddr)
|
||||
{
|
||||
struct sockaddr_in *in;
|
||||
|
||||
@ -260,7 +260,6 @@ static int parse_uri(const uint16_t af_family,
|
||||
static void process_set_peer(int fd, short args, void *cbdata)
|
||||
{
|
||||
mca_oob_tcp_peer_op_t *pop = (mca_oob_tcp_peer_op_t*)cbdata;
|
||||
struct sockaddr inaddr;
|
||||
mca_oob_tcp_peer_t *peer;
|
||||
int rc=ORTE_SUCCESS;
|
||||
uint64_t *ui64 = (uint64_t*)(&pop->peer);
|
||||
@ -290,7 +289,8 @@ static void process_set_peer(int fd, short args, void *cbdata)
|
||||
}
|
||||
}
|
||||
|
||||
if ((rc = parse_uri(pop->af_family, pop->net, pop->port, (struct sockaddr*) &inaddr)) != ORTE_SUCCESS) {
|
||||
maddr = OBJ_NEW(mca_oob_tcp_addr_t);
|
||||
if ((rc = parse_uri(pop->af_family, pop->net, pop->port, (struct sockaddr_storage*) &(maddr->addr))) != ORTE_SUCCESS) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
goto cleanup;
|
||||
}
|
||||
@ -301,8 +301,7 @@ static void process_set_peer(int fd, short args, void *cbdata)
|
||||
ORTE_NAME_PRINT(&pop->peer),
|
||||
(NULL == pop->net) ? "NULL" : pop->net,
|
||||
(NULL == pop->port) ? "NULL" : pop->port);
|
||||
maddr = OBJ_NEW(mca_oob_tcp_addr_t);
|
||||
memcpy(&maddr->addr, &inaddr, sizeof(inaddr));
|
||||
/* memcpy(&maddr->addr, &inaddr, sizeof(inaddr)); */
|
||||
opal_list_append(&peer->addrs, &maddr->super);
|
||||
|
||||
cleanup:
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user