substituted HIO_MEMMOVE() for HIO_MEMCPY() in delete_attribute in lib/rad-msg.c

This commit is contained in:
hyung-hwan 2023-01-02 07:01:50 +00:00
parent d6f9917389
commit b864800a71
7 changed files with 14 additions and 13 deletions

View File

@ -973,7 +973,7 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
csck->on_disconnect = cgi_client_on_disconnect; csck->on_disconnect = cgi_client_on_disconnect;
HIO_ASSERT (hio, cli->rsrc == HIO_NULL); HIO_ASSERT (hio, cli->rsrc == HIO_NULL);
HIO_SVC_HTTS_RSRC_ATTACH (cgi, cli->rsrc); /* cli->rsrc = cgi */ HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)cgi, cli->rsrc); /* cli->rsrc = cgi */
if (access(mi.cmd, X_OK) == -1) if (access(mi.cmd, X_OK) == -1)
{ {
@ -984,7 +984,7 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
cgi->peer = hio_dev_pro_make(hio, HIO_SIZEOF(*peer_xtn), &mi); cgi->peer = hio_dev_pro_make(hio, HIO_SIZEOF(*peer_xtn), &mi);
if (HIO_UNLIKELY(!cgi->peer)) goto oops; if (HIO_UNLIKELY(!cgi->peer)) goto oops;
peer_xtn = hio_dev_pro_getxtn(cgi->peer); peer_xtn = hio_dev_pro_getxtn(cgi->peer);
HIO_SVC_HTTS_RSRC_ATTACH (cgi, peer_xtn->cgi); /* peer->cgi in pro = cgi */ HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)cgi, peer_xtn->cgi); /* peer->cgi in pro = cgi */
cgi->peer_htrd = hio_htrd_open(hio, HIO_SIZEOF(*peer_xtn)); cgi->peer_htrd = hio_htrd_open(hio, HIO_SIZEOF(*peer_xtn));
if (HIO_UNLIKELY(!cgi->peer_htrd)) goto oops; if (HIO_UNLIKELY(!cgi->peer_htrd)) goto oops;
@ -992,7 +992,7 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
hio_htrd_setrecbs (cgi->peer_htrd, &peer_htrd_recbs); hio_htrd_setrecbs (cgi->peer_htrd, &peer_htrd_recbs);
peer_xtn = hio_htrd_getxtn(cgi->peer_htrd); peer_xtn = hio_htrd_getxtn(cgi->peer_htrd);
HIO_SVC_HTTS_RSRC_ATTACH (cgi, peer_xtn->cgi); /* peer->cgi in htrd = cgi */ HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)cgi, peer_xtn->cgi); /* peer->cgi in htrd = cgi */
#if !defined(CGI_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH) #if !defined(CGI_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH)
if (cgi->req_content_length_unlimited) if (cgi->req_content_length_unlimited)

View File

@ -532,13 +532,13 @@ int hio_svc_htts_dofcgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t*
csck->on_disconnect = fcgi_client_on_disconnect; csck->on_disconnect = fcgi_client_on_disconnect;
HIO_ASSERT (hio, cli->rsrc == HIO_NULL); HIO_ASSERT (hio, cli->rsrc == HIO_NULL);
HIO_SVC_HTTS_RSRC_ATTACH (fcgi, cli->rsrc); /* cli->rsrc = fcgi */ HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)fcgi, cli->rsrc); /* cli->rsrc = fcgi */
#if 0 // TODO #if 0 // TODO
fcgi->peer = hio_dev_pro_make(hio, HIO_SIZEOF(*peer_xtn), &mi); fcgi->peer = hio_dev_pro_make(hio, HIO_SIZEOF(*peer_xtn), &mi);
if (HIO_UNLIKELY(!fcgi->peer)) goto oops; if (HIO_UNLIKELY(!fcgi->peer)) goto oops;
peer_xtn = hio_dev_pro_getxtn(fcgi->peer); peer_xtn = hio_dev_pro_getxtn(fcgi->peer);
HIO_SVC_HTTS_RSRC_ATTACH (fcgi, peer_xtn->fcgi); /* peer->fcgi = fcgi */ HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)fcgi, peer_xtn->fcgi); /* peer->fcgi = fcgi */
#else #else
fcgi->peer = hio_svc_fcgic_tie(htts->fcgic, fcgis_addr /* TODO: add a read callback */); fcgi->peer = hio_svc_fcgic_tie(htts->fcgic, fcgis_addr /* TODO: add a read callback */);
if (HIO_UNLIKELY(!fcgi->peer)) goto oops; if (HIO_UNLIKELY(!fcgi->peer)) goto oops;
@ -553,7 +553,7 @@ int hio_svc_htts_dofcgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t*
hio_htrd_setrecbs (fcgi->peer_htrd, &peer_htrd_recbs); hio_htrd_setrecbs (fcgi->peer_htrd, &peer_htrd_recbs);
peer = hio_htrd_getxtn(fcgi->peer_htrd); peer = hio_htrd_getxtn(fcgi->peer_htrd);
HIO_SVC_HTTS_RSRC_ATTACH (fcgi, peer->fcgi); /* peer->fcgi = fcgi */ HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)fcgi, peer->fcgi); /* peer->fcgi = fcgi */
#endif #endif
#if !defined(FCGI_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH) #if !defined(FCGI_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH)

View File

@ -810,7 +810,7 @@ int hio_svc_htts_dofile (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t*
file->peer = -1; file->peer = -1;
HIO_ASSERT (hio, cli->rsrc == HIO_NULL); /* you must not call this function while cli->rsrc is not HIO_NULL */ HIO_ASSERT (hio, cli->rsrc == HIO_NULL); /* you must not call this function while cli->rsrc is not HIO_NULL */
HIO_SVC_HTTS_RSRC_ATTACH (file, cli->rsrc); /* cli->rsrc = file with ref-count up */ HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)file, cli->rsrc); /* cli->rsrc = file with ref-count up */
#if !defined(FILE_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH) #if !defined(FILE_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH)

View File

@ -703,7 +703,7 @@ hio_bch_t* hio_svc_htts_dupmergepaths (hio_svc_htts_t* htts, const hio_bch_t* ba
ta[idx++] = base; ta[idx++] = base;
if (path[0] != '\0') if (path[0] != '\0')
{ {
ta[idx++] = "/"; if (base[hio_count_bcstr(base) - 1] != '/') ta[idx++] = "/";
ta[idx++] = path; ta[idx++] = path;
} }
ta[idx++] = HIO_NULL; ta[idx++] = HIO_NULL;

View File

@ -878,7 +878,7 @@ int hio_svc_htts_dothr (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
csck->on_disconnect = thr_client_on_disconnect; csck->on_disconnect = thr_client_on_disconnect;
HIO_ASSERT (hio, cli->rsrc == HIO_NULL); HIO_ASSERT (hio, cli->rsrc == HIO_NULL);
HIO_SVC_HTTS_RSRC_ATTACH (thr_state, cli->rsrc); HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)thr_state, cli->rsrc);
thr_state->peer = hio_dev_thr_make(hio, HIO_SIZEOF(*thr_peer), &mi); thr_state->peer = hio_dev_thr_make(hio, HIO_SIZEOF(*thr_peer), &mi);
if (HIO_UNLIKELY(!thr_state->peer)) if (HIO_UNLIKELY(!thr_state->peer))
@ -890,7 +890,7 @@ int hio_svc_htts_dothr (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
tfs = HIO_NULL; /* mark that tfs is delegated to the thread */ tfs = HIO_NULL; /* mark that tfs is delegated to the thread */
thr_peer = hio_dev_thr_getxtn(thr_state->peer); thr_peer = hio_dev_thr_getxtn(thr_state->peer);
HIO_SVC_HTTS_RSRC_ATTACH (thr_state, thr_peer->state); HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)thr_state, thr_peer->state);
thr_state->peer_htrd = hio_htrd_open(hio, HIO_SIZEOF(*thr_peer)); thr_state->peer_htrd = hio_htrd_open(hio, HIO_SIZEOF(*thr_peer));
if (HIO_UNLIKELY(!thr_state->peer_htrd)) goto oops; if (HIO_UNLIKELY(!thr_state->peer_htrd)) goto oops;
@ -898,7 +898,7 @@ int hio_svc_htts_dothr (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
hio_htrd_setrecbs (thr_state->peer_htrd, &thr_peer_htrd_recbs); hio_htrd_setrecbs (thr_state->peer_htrd, &thr_peer_htrd_recbs);
thr_peer = hio_htrd_getxtn(thr_state->peer_htrd); thr_peer = hio_htrd_getxtn(thr_state->peer_htrd);
HIO_SVC_HTTS_RSRC_ATTACH (thr_state, thr_peer->state); HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)thr_state, thr_peer->state);
#if !defined(THR_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH) #if !defined(THR_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH)
if (thr_state->req_content_length_unlimited) if (thr_state->req_content_length_unlimited)

View File

@ -345,7 +345,7 @@ int hio_svc_htts_dotxt (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
csck->on_disconnect = txt_client_on_disconnect; csck->on_disconnect = txt_client_on_disconnect;
HIO_ASSERT (hio, cli->rsrc == HIO_NULL); HIO_ASSERT (hio, cli->rsrc == HIO_NULL);
HIO_SVC_HTTS_RSRC_ATTACH (txt, cli->rsrc); HIO_SVC_HTTS_RSRC_ATTACH ((hio_svc_htts_rsrc_t*)txt, cli->rsrc);
if (req->flags & HIO_HTRE_ATTR_EXPECT100) if (req->flags & HIO_HTRE_ATTR_EXPECT100)
{ {

View File

@ -378,7 +378,8 @@ static int delete_attribute (hio_rad_hdr_t* auth, hio_rad_attr_hdr_t* attr)
tmp_len = ((hio_uint8_t*)attr - (hio_uint8_t*)auth) + attr->length; tmp_len = ((hio_uint8_t*)attr - (hio_uint8_t*)auth) + attr->length;
if (tmp_len > auth_len) return -1; /* can this happen? */ if (tmp_len > auth_len) return -1; /* can this happen? */
HIO_MEMCPY (attr, (hio_uint8_t*)attr + attr->length, auth_len - tmp_len); /* HIO_MEMCPY() on some platforms doesn't handle overlappig memory regions */
HIO_MEMMOVE (attr, (hio_uint8_t*)attr + attr->length, auth_len - tmp_len);
auth_len -= attr->length; auth_len -= attr->length;
auth->length = hio_hton16(auth_len); auth->length = hio_hton16(auth_len);