Commit 5b856458 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

s/SAFEMEMCPY/AC_MEMCPY/

Use AC_FMEMCPY where appropriate (-llber)
parent f4f2d7eb
......@@ -603,7 +603,7 @@ time2text( char *ldtimestr, int dateonly )
timestr[ strlen( timestr ) - 1 ] = zone; /* replace trailing newline */
if ( dateonly ) {
SAFEMEMCPY( timestr + 11, timestr + 20, strlen( timestr + 20 ) + 1 );
AC_MEMCPY( timestr + 11, timestr + 20, strlen( timestr + 20 ) + 1 );
}
return( strdup( timestr ) );
......
......@@ -208,13 +208,13 @@ StringToKey(
strncat (password, cell, sizeof(password)-passlen);
if ((passlen = strlen(password)) > sizeof(password)) passlen = sizeof(password);
memcpy(ivec, "kerberos", 8);
memcpy(temp_key, "kerberos", 8);
AC_MEMCPY(ivec, "kerberos", 8);
AC_MEMCPY(temp_key, "kerberos", 8);
des_fixup_key_parity (temp_key);
des_key_sched (temp_key, schedule);
des_cbc_cksum (password, ivec, passlen, schedule, ivec);
memcpy(temp_key, ivec, 8);
AC_MEMCPY(temp_key, ivec, 8);
des_fixup_key_parity (temp_key);
des_key_sched (temp_key, schedule);
des_cbc_cksum (password, key, passlen, schedule, ivec);
......
......@@ -92,7 +92,7 @@ fetch_buffer( char *buffer, int length, FILE *where )
if ( isprint( (unsigned char) *p )) {
++p;
} else {
SAFEMEMCPY( p, p + 1, strlen( p + 1 ) + 1 );
AC_MEMCPY( p, p + 1, strlen( p + 1 ) + 1 );
}
}
......
......@@ -533,7 +533,7 @@ ber_put_seqorset( BerElement *ber )
* the length field. Move the data if
* we don't actually need that much
*/
SAFEMEMCPY( (*sos)->sos_first + taglen +
AC_MEMCPY( (*sos)->sos_first + taglen +
lenlen, (*sos)->sos_first + taglen +
FOUR_BYTE_LEN, len );
}
......@@ -583,7 +583,7 @@ ber_put_seqorset( BerElement *ber )
tmptag >>= 8;
}
SAFEMEMCPY( (*sos)->sos_first,
AC_FMEMCPY( (*sos)->sos_first,
&nettag[sizeof(ber_tag_t) - taglen],
taglen );
......@@ -594,12 +594,12 @@ ber_put_seqorset( BerElement *ber )
}
/* one byte of length length */
SAFEMEMCPY( (*sos)->sos_first + 1, &ltag, 1 );
(*sos)->sos_first[1] = ltag;
if ( ber->ber_options & LBER_USE_DER ) {
if (lenlen > 1) {
/* Write the length itself */
SAFEMEMCPY( (*sos)->sos_first + 2,
AC_FMEMCPY( (*sos)->sos_first + 2,
&netlen[sizeof(ber_len_t) - (lenlen - 1)],
lenlen - 1 );
}
......@@ -609,13 +609,13 @@ ber_put_seqorset( BerElement *ber )
* the length field. Move the data if
* we don't actually need that much
*/
SAFEMEMCPY( (*sos)->sos_first + taglen +
AC_FMEMCPY( (*sos)->sos_first + taglen +
lenlen, (*sos)->sos_first + taglen +
FOUR_BYTE_LEN, len );
}
} else {
/* the length itself */
SAFEMEMCPY( (*sos)->sos_first + taglen + 1,
AC_FMEMCPY( (*sos)->sos_first + taglen + 1,
&netlen[sizeof(ber_len_t) - (FOUR_BYTE_LEN - 1)],
FOUR_BYTE_LEN - 1 );
}
......
......@@ -88,7 +88,7 @@ ber_read(
nleft = ber->ber_end - ber->ber_ptr;
actuallen = nleft < len ? nleft : len;
SAFEMEMCPY( buf, ber->ber_ptr, actuallen );
AC_MEMCPY( buf, ber->ber_ptr, actuallen );
ber->ber_ptr += actuallen;
......@@ -112,7 +112,7 @@ ber_write(
if ( ber_realloc( ber, len ) != 0 )
return( -1 );
}
SAFEMEMCPY( ber->ber_ptr, buf, (size_t)len );
AC_MEMCPY( ber->ber_ptr, buf, (size_t)len );
ber->ber_ptr += len;
return( (ber_slen_t) len );
......@@ -121,7 +121,7 @@ ber_write(
if ( ber_realloc( ber, len ) != 0 )
return( -1 );
}
SAFEMEMCPY( ber->ber_sos->sos_ptr, buf, (size_t)len );
AC_MEMCPY( ber->ber_sos->sos_ptr, buf, (size_t)len );
ber->ber_sos->sos_ptr += len;
ber->ber_sos->sos_clen += len;
return( (ber_slen_t) len );
......@@ -392,7 +392,7 @@ int ber_flatten(
return( -1 );
}
SAFEMEMCPY( bv->bv_val, ber->ber_buf, len );
AC_MEMCPY( bv->bv_val, ber->ber_buf, len );
bv->bv_val[len] = '\0';
bv->bv_len = len;
}
......
......@@ -473,7 +473,7 @@ ber_bvdup(
return NULL;
}
SAFEMEMCPY( new->bv_val, bv->bv_val, bv->bv_len );
AC_MEMCPY( new->bv_val, bv->bv_val, bv->bv_len );
new->bv_val[bv->bv_len] = '\0';
new->bv_len = bv->bv_len;
......@@ -564,6 +564,6 @@ ber_strdup( LDAP_CONST char *s )
return( NULL );
}
SAFEMEMCPY( p, s, len );
AC_MEMCPY( p, s, len );
return( p );
}
......@@ -124,7 +124,7 @@ ber_set_option(
return LBER_OPT_ERROR;
}
memcpy(ber_int_memory_fns, f, sizeof(BerMemoryFunctions));
AC_MEMCPY(ber_int_memory_fns, f, sizeof(BerMemoryFunctions));
ber_int_options.lbo_valid = LBER_INITIALIZED;
return LBER_OPT_SUCCESS;
......
......@@ -239,7 +239,7 @@ ber_pvt_sb_copy_out( Sockbuf_Buf *sbb, char *buf, ber_len_t len )
max = sbb->buf_end - sbb->buf_ptr;
max = ( max < len) ? max : len;
if ( max ) {
memcpy( buf, sbb->buf_base + sbb->buf_ptr, max );
AC_MEMCPY( buf, sbb->buf_base + sbb->buf_ptr, max );
sbb->buf_ptr += max;
if ( sbb->buf_ptr >= sbb->buf_end )
sbb->buf_ptr = sbb->buf_end = 0;
......@@ -658,7 +658,7 @@ sb_dgram_ctrl( Sockbuf_IO_Desc *sbiod, int opt, void *arg )
p = (struct dgram_data *)sbiod->sbiod_pvt;
if ( opt == LBER_SB_OPT_UDP_SET_DST ) {
memcpy( &p->dst, arg, sizeof( struct sockaddr ) );
AC_MEMCPY( &p->dst, arg, sizeof( struct sockaddr ) );
return 1;
}
else if ( opt == LBER_SB_OPT_UDP_GET_SRC ) {
......
......@@ -240,7 +240,7 @@ ldap_add_request_to_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
ld->ld_errno = LDAP_NO_MEMORY;
return;
}
SAFEMEMCPY( new->lm_ber->ber_buf, request->ber_buf,
AC_MEMCPY( new->lm_ber->ber_buf, request->ber_buf,
(size_t)len );
new->lm_ber->ber_ptr = new->lm_ber->ber_buf;
new->lm_ber->ber_end = new->lm_ber->ber_buf + len;
......@@ -498,7 +498,7 @@ msg_dup( LDAPMessage *msg )
LDAP_FREE( (char *)new );
return( NULL );
}
SAFEMEMCPY( new->lm_ber->ber_buf, msg->lm_ber->ber_buf,
AC_MEMCPY( new->lm_ber->ber_buf, msg->lm_ber->ber_buf,
(size_t)len );
new->lm_ber->ber_ptr = new->lm_ber->ber_buf +
( msg->lm_ber->ber_ptr - msg->lm_ber->ber_buf );
......
......@@ -139,7 +139,7 @@ cldap_open( LDAP_CONST char *host, int port )
}
for ( i = 0; hp->h_addr_list[ i ] != 0; ++i ) {
SAFEMEMCPY( (char *)&sock.sin_addr,
AC_MEMCPY( (char *)&sock.sin_addr,
(char *)hp->h_addr_list[ i ],
sizeof(sock.sin_addr));
if ( add_addr( ld, (struct sockaddr *)&sock ) < 0 ) {
......@@ -287,7 +287,7 @@ add_addr( LDAP *ld, struct sockaddr *sap )
return( -1 );
}
SAFEMEMCPY( (char *)newsap, (char *)sap, sizeof( struct sockaddr ));
AC_MEMCPY( (char *)newsap, (char *)sap, sizeof( struct sockaddr ));
addrs[ ld->ld_cldapnaddr++ ] = newsap;
ld->ld_cldapaddrs = (void **)addrs;
return( 0 );
......
......@@ -348,7 +348,7 @@ ldap_control_dup( const LDAPControl *c )
return NULL;
}
SAFEMEMCPY( new->ldctl_value.bv_val, c->ldctl_value.bv_val,
AC_MEMCPY( new->ldctl_value.bv_val, c->ldctl_value.bv_val,
c->ldctl_value.bv_len );
new->ldctl_value.bv_len = c->ldctl_value.bv_len;
......
......@@ -135,7 +135,7 @@ next_line( char **bufp, ber_len_t *blenp, char **linep )
return( -1 ); /* fatal error */
}
(void) memcpy( line, linestart, p - linestart );
AC_MEMCPY( line, linestart, p - linestart );
line[ p - linestart - 1 ] = '\0';
*linep = line;
return( strlen( line ));
......
......@@ -334,7 +334,7 @@ explode_name( const char *name, int notypes, int is_type )
if (( parts[ count-1 ] = (char *)LDAP_CALLOC( 1,
len + 1 )) != NULL )
{
SAFEMEMCPY( parts[ count-1 ], rdn, len );
AC_MEMCPY( parts[ count-1 ], rdn, len );
if( !endquote ) {
/* skip trailing spaces */
......
......@@ -104,7 +104,7 @@ ldap_get_entry_controls(
}
/* make a local copy of the BerElement */
SAFEMEMCPY(&be, entry->lm_ber, sizeof(be));
AC_MEMCPY(&be, entry->lm_ber, sizeof(be));
if ( ber_scanf( &be, "{xx" /*}*/ ) == LBER_ERROR ) {
rc = LDAP_DECODING_ERROR;
......
......@@ -370,7 +370,7 @@ ldap_build_filter(
*f++ = ' ';
}
slen = strlen( valwords[ i ] );
SAFEMEMCPY( f, valwords[ i ], slen );
AC_MEMCPY( f, valwords[ i ], slen );
f += slen;
}
}
......@@ -379,17 +379,17 @@ ldap_build_filter(
if ( wordcount > 0 ) {
wordnum = wordcount - 1;
slen = strlen( valwords[ wordnum ] );
SAFEMEMCPY( f, valwords[ wordnum ], slen );
AC_MEMCPY( f, valwords[ wordnum ], slen );
f += slen;
}
} else if ( value != NULL ) {
slen = strlen( value );
SAFEMEMCPY( f, value, slen );
AC_MEMCPY( f, value, slen );
f += slen;
}
} else if ( *p == 'a' && attr != NULL ) {
slen = strlen( attr );
SAFEMEMCPY( f, attr, slen );
AC_MEMCPY( f, attr, slen );
f += slen;
} else {
*f++ = *p;
......
......@@ -275,7 +275,7 @@ ldap_get_kerberosv4_credentials(
}
*len = ktxt.length;
memcpy( cred, ktxt.dat, ktxt.length );
AC_MEMCPY( cred, ktxt.dat, ktxt.length );
return( cred );
}
......
......@@ -135,7 +135,7 @@ ldap_create( LDAP **ldp )
}
/* copy the global options */
memcpy(&ld->ld_options, gopts, sizeof(ld->ld_options));
AC_MEMCPY(&ld->ld_options, gopts, sizeof(ld->ld_options));
ld->ld_valid = LDAP_VALID_SESSION;
......
......@@ -74,7 +74,7 @@ ldap_int_timeval_dup( struct timeval **dest, const struct timeval *src )
return 1;
}
SAFEMEMCPY( (char *) new, (const char *) src, sizeof(struct timeval));
AC_MEMCPY( (char *) new, (const char *) src, sizeof(struct timeval));
*dest = new;
return 0;
......@@ -394,7 +394,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
sin.sin_port = port;
p = (char *)&sin.sin_addr;
q = use_hp ? (char *)hp->h_addr_list[i] : (char *)&address;
SAFEMEMCPY(p, q, sizeof(sin.sin_addr) );
AC_MEMCPY(p, q, sizeof(sin.sin_addr) );
osip_debug(ld, "ldap_connect_to_host: Trying %s:%d\n",
inet_ntoa(sin.sin_addr),ntohs(sin.sin_port),0);
......
......@@ -105,7 +105,7 @@ ldap_parse_reference(
}
/* make a private copy of BerElement */
SAFEMEMCPY(&be, ref->lm_ber, sizeof(be));
AC_MEMCPY(&be, ref->lm_ber, sizeof(be));
if ( ber_scanf( &be, "{v" /*}*/, &refs ) == LBER_ERROR ) {
rc = LDAP_DECODING_ERROR;
......
......@@ -938,7 +938,7 @@ time2text( char *ldtimestr, int dateonly )
timestr[ strlen( timestr ) - 1 ] = zone; /* replace trailing newline */
if ( dateonly ) {
SAFEMEMCPY( timestr + 11, timestr + 20, strlen( timestr + 20 ) + 1 );
AC_MEMCPY( timestr + 11, timestr + 20, strlen( timestr + 20 ) + 1 );
}
return( timestr );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment