s/SAFEMEMCPY/AC_MEMCPY/

Use AC_FMEMCPY where appropriate (-llber)
This commit is contained in:
Kurt Zeilenga 2000-07-28 01:07:07 +00:00
parent f4f2d7eb38
commit 5b856458a2
52 changed files with 112 additions and 112 deletions

View File

@ -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 ) );

View File

@ -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);

View File

@ -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 );
}
}

View File

@ -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 );
}

View File

@ -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;
}

View File

@ -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 );
}

View File

@ -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;

View File

@ -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 ) {

View File

@ -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 );

View File

@ -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 );

View File

@ -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;

View File

@ -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 ));

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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 );
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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 );

View File

@ -98,7 +98,7 @@ ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, char *prefix,
if ( (quote = strrchr( ufncomp[ncomp], '"' )) != NULL )
*quote = '\0';
SAFEMEMCPY( ufncomp[ncomp], ufncomp[ncomp] + 1,
AC_MEMCPY( ufncomp[ncomp], ufncomp[ncomp] + 1,
strlen( ufncomp[ncomp] + 1 ) + 1 );
}
if ( ncomp == 0 )

View File

@ -83,7 +83,7 @@ char *ldap_pvt_ctime( const time_t *tp, char *buf )
# ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_lock( &ldap_int_ctime_mutex );
# endif
memcpy( buf, ctime(tp), 26 );
AC_MEMCPY( buf, ctime(tp), 26 );
# ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ldap_int_ctime_mutex );
# endif
@ -288,7 +288,7 @@ static char *cpy_aliases( char ***tgtio, char *buf, char **src )
char **tgt=*tgtio;
for( ; (*src) ; src++ ) {
len = strlen( *src ) + 1;
memcpy( buf, *src, len );
AC_MEMCPY( buf, *src, len );
*tgt++=buf;
buf+=len;
}
@ -300,7 +300,7 @@ static char *cpy_addresses( char ***tgtio, char *buf, char **src, int len )
{
char **tgt=*tgtio;
for( ; (*src) ; src++ ) {
memcpy( buf, *src, len );
AC_MEMCPY( buf, *src, len );
*tgt++=buf;
buf+=len;
}
@ -343,9 +343,9 @@ static int copy_hostent( struct hostent *res, char **buf, struct hostent * src )
if (safe_realloc( buf, total_len )) {
tp = (char **) *buf;
tbuf = *buf + (n_alias + n_addr + 2) * sizeof( char * );
memcpy( res, src, sizeof( struct hostent ) );
AC_MEMCPY( res, src, sizeof( struct hostent ) );
/* first the name... */
memcpy( tbuf, src->h_name, name_len );
AC_MEMCPY( tbuf, src->h_name, name_len );
res->h_name = tbuf; tbuf+=name_len;
/* now the aliases */
res->h_aliases = tp;

View File

@ -51,7 +51,7 @@ ldbm_datum_dup( LDBM ldbm, Datum data )
}
dup.dsize = data.dsize;
if ( (dup.dptr = (char *) malloc( data.dsize )) != NULL )
memcpy( dup.dptr, data.dptr, data.dsize );
AC_MEMCPY( dup.dptr, data.dptr, data.dsize );
return( dup );
}
@ -811,7 +811,7 @@ ldbm_fetch( LDBM ldbm, Datum key )
k.key.dsize = key.dsize + 1;
k.key.dptr = malloc(k.key.dsize);
*(k.key.dptr) = 'l';
memcpy( (void *)(k.key.dptr + 1), key.dptr, key.dsize );
AC_MEMCPY( (void *)(k.key.dptr + 1), key.dptr, key.dsize );
#else
k.key = key;
#endif
@ -879,7 +879,7 @@ ldbm_store( LDBM ldbm, Datum key, Datum data, int flags )
int_key.dsize = key.dsize + 1;
int_key.dptr = malloc( int_key.dsize );
*(int_key.dptr) = 'l'; /* Must not be NULL !*/
memcpy( (void *)(int_key.dptr + 1), key.dptr, key.dsize );
AC_MEMCPY( (void *)(int_key.dptr + 1), key.dptr, key.dsize );
#else
int_key = key;
#endif
@ -918,7 +918,7 @@ ldbm_delete( LDBM ldbm, Datum key )
int_key.dsize = key.dsize + 1;
int_key.dptr = malloc(int_key.dsize);
*(int_key.dptr) = 'l';
memcpy( (void *)(int_key.dptr + 1), key.dptr, key.dsize );
AC_MEMCPY( (void *)(int_key.dptr + 1), key.dptr, key.dsize );
#else
int_key = key;
#endif
@ -974,7 +974,7 @@ ldbm_get_next( LDBM ldbm, kvpair (*fptr)(MDBM *, kvpair) )
} else {
memcpy(ret.dptr, (void *)(out.key.dptr + delta),
AC_MEMCPY(ret.dptr, (void *)(out.key.dptr + delta),
ret.dsize );
}

View File

@ -80,7 +80,7 @@ ldif_fetch_url(
return -1;
}
p = newp;
SAFEMEMCPY( &p[total], buffer, bytes );
AC_MEMCPY( &p[total], buffer, bytes );
total += bytes;
}

View File

@ -231,7 +231,7 @@ done:
ber_memfree( freeme );
return( -1 );
}
memcpy( p, value, vlen );
AC_MEMCPY( p, value, vlen );
p[vlen] = '\0';
value = p;
}

View File

@ -446,7 +446,7 @@ add_decomp(unsigned long code)
* Shift the decomps up by one if the codes don't match.
*/
for (j = decomps_used; j > i; j--)
(void) memcpy((char *) &decomps[j], (char *) &decomps[j - 1],
(void) AC_MEMCPY((char *) &decomps[j], (char *) &decomps[j - 1],
sizeof(_decomp_t));
}
@ -470,7 +470,7 @@ add_decomp(unsigned long code)
decomps[i].code = code;
decomps[i].used = dectmp_size;
(void) memcpy((char *) decomps[i].decomp, (char *) dectmp,
(void) AC_MEMCPY((char *) decomps[i].decomp, (char *) dectmp,
sizeof(unsigned long) * dectmp_size);
}
@ -504,7 +504,7 @@ add_title(unsigned long code)
* Shift the array up by one.
*/
for (j = title_used; j > i; j--)
(void) memcpy((char *) &title[j], (char *) &title[j - 1],
(void) AC_MEMCPY((char *) &title[j], (char *) &title[j - 1],
sizeof(_case_t));
}
@ -551,7 +551,7 @@ add_upper(unsigned long code)
* Shift the array up by one.
*/
for (j = upper_used; j > i; j--)
(void) memcpy((char *) &upper[j], (char *) &upper[j - 1],
(void) AC_MEMCPY((char *) &upper[j], (char *) &upper[j - 1],
sizeof(_case_t));
}
@ -598,7 +598,7 @@ add_lower(unsigned long code)
* Shift the array up by one.
*/
for (j = lower_used; j > i; j--)
(void) memcpy((char *) &lower[j], (char *) &lower[j - 1],
(void) AC_MEMCPY((char *) &lower[j], (char *) &lower[j - 1],
sizeof(_case_t));
}

View File

@ -1113,7 +1113,7 @@ _ure_make_symbol(ucs2_t *sym, unsigned long limit, unsigned long *consumed,
}
symbol.id = b->symtab_used++;
(void) memcpy((char *) &b->symtab[symbol.id], (char *) &symbol,
(void) AC_MEMCPY((char *) &b->symtab[symbol.id], (char *) &symbol,
sizeof(_ure_symtab_t));
return symbol.id;
@ -1347,7 +1347,7 @@ _ure_add_state(ucs2_t nstates, ucs2_t *states, _ure_buffer_t *b)
sp->st.slist_size = sp->st.slist_used + nstates;
}
sp->st.slist_used = nstates;
(void) memcpy((char *) sp->st.slist, (char *) states,
(void) AC_MEMCPY((char *) sp->st.slist, (char *) states,
sizeof(ucs2_t) * nstates);
}

View File

@ -140,7 +140,7 @@ int lutil_entropy( char *buf, ber_len_t nbytes )
lutil_MD5Final( digest, &ctx );
memcpy( &buf[n], digest,
AC_MEMCPY( &buf[n], digest,
nbytes - n >= 16 ? 16 : nbytes - n );
}

View File

@ -110,10 +110,10 @@ lutil_MD5Update(
t = 64-t;
if (len < t) {
memcpy(p, buf, len);
AC_MEMCPY(p, buf, len);
return;
}
memcpy(p, buf, t);
AC_MEMCPY(p, buf, t);
lutil_MD5Transform(ctx->buf, ctx->in);
buf += t;
len -= t;
@ -122,7 +122,7 @@ lutil_MD5Update(
/* Process data in 64-byte chunks */
while (len >= 64) {
memcpy(ctx->in, buf, 64);
AC_MEMCPY(ctx->in, buf, 64);
lutil_MD5Transform(ctx->buf, ctx->in);
buf += 64;
len -= 64;
@ -130,7 +130,7 @@ lutil_MD5Update(
/* Handle any remaining bytes of data. */
memcpy(ctx->in, buf, len);
AC_MEMCPY(ctx->in, buf, len);
}
/*

View File

@ -351,8 +351,8 @@ static struct berval * pw_string(
return NULL;
}
memcpy( pw->bv_val, sc->name.bv_val, sc->name.bv_len );
memcpy( &pw->bv_val[sc->name.bv_len], passwd->bv_val, passwd->bv_len );
AC_MEMCPY( pw->bv_val, sc->name.bv_val, sc->name.bv_len );
AC_MEMCPY( &pw->bv_val[sc->name.bv_len], passwd->bv_val, passwd->bv_len );
pw->bv_val[pw->bv_len] = '\0';
return pw;
@ -380,9 +380,9 @@ static struct berval * pw_string64(
return NULL;
}
memcpy( string.bv_val, hash->bv_val,
AC_MEMCPY( string.bv_val, hash->bv_val,
hash->bv_len );
memcpy( &string.bv_val[hash->bv_len], salt->bv_val,
AC_MEMCPY( &string.bv_val[hash->bv_len], salt->bv_val,
salt->bv_len );
string.bv_val[string.bv_len] = '\0';
@ -400,7 +400,7 @@ static struct berval * pw_string64(
return NULL;
}
memcpy(b64->bv_val, sc->name.bv_val, sc->name.bv_len);
AC_MEMCPY(b64->bv_val, sc->name.bv_val, sc->name.bv_len);
rc = lutil_b64_ntop(
string.bv_val, string.bv_len,

View File

@ -71,7 +71,7 @@ lutil_SHA1Transform( uint32 *state, const unsigned char *buffer )
#ifdef SHA1HANDSOFF
uint32 block[16];
(void)memcpy(block, buffer, 64);
(void)AC_MEMCPY(block, buffer, 64);
#else
uint32 *block = (u_int32 *) buffer;
#endif
@ -151,7 +151,7 @@ lutil_SHA1Update(
context->count[1] += (len>>29)+1;
j = (j >> 3) & 63;
if ((j + len) > 63) {
(void)memcpy(&context->buffer[j], data, (i = 64-j));
(void)AC_MEMCPY(&context->buffer[j], data, (i = 64-j));
lutil_SHA1Transform(context->state, context->buffer);
for ( ; i + 63 < len; i += 64)
lutil_SHA1Transform(context->state, &data[i]);
@ -159,7 +159,7 @@ lutil_SHA1Update(
} else {
i = 0;
}
(void)memcpy(&context->buffer[j], &data[i], len - i);
(void)AC_MEMCPY(&context->buffer[j], &data[i], len - i);
}

View File

@ -879,7 +879,7 @@ aci_bvstrdup( struct berval *bv )
s = (char *)ch_malloc(bv->bv_len + 1);
if (s != NULL) {
memcpy(s, bv->bv_val, bv->bv_len);
AC_MEMCPY(s, bv->bv_val, bv->bv_len);
s[bv->bv_len] = 0;
}
return(s);

View File

@ -301,7 +301,7 @@ static int slap_mods2entry(
sizeof( struct berval * ) * (i+j) );
/* should check for duplicates */
memcpy( &attr->a_vals[i], mods->sml_bvalues,
AC_MEMCPY( &attr->a_vals[i], mods->sml_bvalues,
sizeof( struct berval * ) * j );
/* trim the mods array */

View File

@ -247,7 +247,7 @@ at_add(
return SLAP_SCHERR_ATTR_INCOMPLETE;
}
sat = (AttributeType *) ch_calloc( 1, sizeof(AttributeType) );
memcpy( &sat->sat_atype, at, sizeof(LDAPAttributeType));
AC_MEMCPY( &sat->sat_atype, at, sizeof(LDAPAttributeType));
sat->sat_cname = cname;

View File

@ -279,8 +279,8 @@ char* new_superior(
newDN = ch_malloc( dnlen - olen + nlen + 1 );
memcpy( newDN, dn, dnlen - olen );
memcpy( &newDN[dnlen - olen], newSup, nlen );
AC_MEMCPY( newDN, dn, dnlen - olen );
AC_MEMCPY( &newDN[dnlen - olen], newSup, nlen );
newDN[dnlen - olen + nlen] = '\0';
return newDN;

View File

@ -139,7 +139,7 @@ dn2id(
return( NOID );
}
(void) memcpy( (char *) &id, data.dptr, sizeof(ID) );
AC_MEMCPY( (char *) &id, data.dptr, sizeof(ID) );
assert( id != NOID );

View File

@ -25,7 +25,7 @@ static void cont_alloc( Datum *cont, Datum *key )
* (unsigned char *) cont->dptr = SLAP_INDEX_CONT_PREFIX;
memcpy( &((unsigned char *)cont->dptr)[1 + sizeof(ID)],
AC_MEMCPY( &((unsigned char *)cont->dptr)[1 + sizeof(ID)],
key->dptr, key->dsize );
}
@ -196,7 +196,7 @@ idl_fetch(
continue;
}
SAFEMEMCPY(
AC_MEMCPY(
(char *) &ID_BLOCK_ID(idl, nids),
(char *) &ID_BLOCK_ID(tmp[i], 0),
ID_BLOCK_NIDS(tmp[i]) * sizeof(ID) );
@ -275,7 +275,7 @@ idl_split_block(
ID_BLOCK_NIDS(*right) = 1;
ID_BLOCK_ID(*right, 0) = id;
} else {
SAFEMEMCPY(
AC_MEMCPY(
(char *) &ID_BLOCK_ID(*right, 0),
(char *) &ID_BLOCK_ID(b, 0),
nr * sizeof(ID) );
@ -284,7 +284,7 @@ idl_split_block(
}
/* the id being inserted & everything after in the second block */
SAFEMEMCPY(
AC_MEMCPY(
(char *) &ID_BLOCK_ID(*left, (nr == 0 ? 0 : 1)),
(char *) &ID_BLOCK_ID(b, nr),
nl * sizeof(ID) );
@ -517,7 +517,7 @@ idl_insert_key(
k3.dptr = ch_malloc(k2.dsize);
k3.dsize = k2.dsize;
memcpy(k3.dptr, k2.dptr, k3.dsize);
AC_MEMCPY(k3.dptr, k2.dptr, k3.dsize);
if ( (rc = idl_store( be, db, k3, tmp )) != 0 ) {
Debug( LDAP_DEBUG_ANY,
"idl_insert_key: idl_store returned %d\n", rc, 0, 0 );
@ -612,7 +612,7 @@ split:
tmp = idl_alloc( ID_BLOCK_NMAX(idl) + 1 );
ID_BLOCK_NIDS(tmp) = ID_BLOCK_INDIRECT_VALUE;
/* everything up to the split block */
SAFEMEMCPY(
AC_MEMCPY(
(char *) &ID_BLOCK_ID(tmp, 0),
(char *) &ID_BLOCK_ID(idl, 0),
i * sizeof(ID) );
@ -620,7 +620,7 @@ split:
ID_BLOCK_ID(tmp, i) = ID_BLOCK_ID(tmp2, 0);
ID_BLOCK_ID(tmp, i + 1) = ID_BLOCK_ID(tmp3, 0);
/* everything after the split block */
SAFEMEMCPY(
AC_MEMCPY(
(char *) &ID_BLOCK_ID(tmp, i + 2),
(char *) &ID_BLOCK_ID(idl, i + 1),
(ID_BLOCK_NMAX(idl) - i - 1) * sizeof(ID) );
@ -690,7 +690,7 @@ idl_insert( ID_BLOCK **idl, ID id, unsigned int maxids )
}
/* make a slot for the new id */
SAFEMEMCPY( &ID_BLOCK_ID(*idl, i+1), &ID_BLOCK_ID(*idl, i),
AC_MEMCPY( &ID_BLOCK_ID(*idl, i+1), &ID_BLOCK_ID(*idl, i),
(ID_BLOCK_NIDS(*idl) - i) * sizeof(ID) );
ID_BLOCK_ID(*idl, i) = id;
@ -735,7 +735,7 @@ idl_delete_key (
ldbm_cache_delete( db, key );
} else {
SAFEMEMCPY (
AC_MEMCPY(
&ID_BLOCK_ID(idl, i),
&ID_BLOCK_ID(idl, i+1),
(ID_BLOCK_NIDS(idl)-i) * sizeof(ID) );
@ -779,7 +779,7 @@ idl_delete_key (
{
if ( ID_BLOCK_ID(tmp, i) == id )
{
SAFEMEMCPY(
AC_MEMCPY(
&ID_BLOCK_ID(tmp, i),
&ID_BLOCK_ID(tmp, i+1),
(ID_BLOCK_NIDS(tmp)-(i+1)) * sizeof(ID));
@ -791,7 +791,7 @@ idl_delete_key (
} else {
ldbm_cache_delete( db, data );
SAFEMEMCPY(
AC_MEMCPY(
&ID_BLOCK_ID(idl, j),
&ID_BLOCK_ID(idl, j+1),
(nids-(j+1)) * sizeof(ID));
@ -829,7 +829,7 @@ idl_dup( ID_BLOCK *idl )
new = idl_alloc( ID_BLOCK_NMAX(idl) );
SAFEMEMCPY(
AC_MEMCPY(
(char *) new,
(char *) idl,
(ID_BLOCK_NMAX(idl) + ID_BLOCK_IDS_OFFSET) * sizeof(ID) );

View File

@ -40,7 +40,7 @@ next_id_read( Backend *be )
data = ldbm_cache_fetch( db, key );
if( data.dptr != NULL ) {
memcpy( &id, data.dptr, sizeof( ID ) );
AC_MEMCPY( &id, data.dptr, sizeof( ID ) );
ldbm_datum_free( db->dbc_db, data );
} else {

View File

@ -84,7 +84,7 @@ ID ldbm_tool_entry_first(
return NOID;
}
memcpy( &id, key.dptr, key.dsize );
AC_MEMCPY( &id, key.dptr, key.dsize );
ldbm_datum_free( id2entry->dbc_db, key );
@ -109,7 +109,7 @@ ID ldbm_tool_entry_next(
return NOID;
}
memcpy( &id, key.dptr, key.dsize );
AC_MEMCPY( &id, key.dptr, key.dsize );
ldbm_datum_free( id2entry->dbc_db, key );

View File

@ -159,13 +159,13 @@ int backend_add(BackendInfo *aBackendInfo)
/* if backendInfo == binfo no deallocation of old backendInfo */
if (backendInfo == binfo) {
newBackendInfo = ch_calloc(nBackendInfo + 1, sizeof(BackendInfo));
memcpy(newBackendInfo, backendInfo, sizeof(BackendInfo) *
AC_MEMCPY(newBackendInfo, backendInfo, sizeof(BackendInfo) *
nBackendInfo);
} else {
newBackendInfo = ch_realloc(backendInfo, sizeof(BackendInfo) *
(nBackendInfo + 1));
}
memcpy(&newBackendInfo[nBackendInfo], aBackendInfo,
AC_MEMCPY(&newBackendInfo[nBackendInfo], aBackendInfo,
sizeof(BackendInfo));
backendInfo = newBackendInfo;
nBackendInfo++;

View File

@ -882,12 +882,12 @@ strtok_quote( char *line, char *sep )
} else {
inquote = 1;
}
SAFEMEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
AC_MEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
break;
case '\\':
if ( next[1] )
SAFEMEMCPY( next,
AC_MEMCPY( next,
next + 1, strlen( next + 1 ) + 1 );
next++; /* dont parse the escaped character */
break;

View File

@ -348,7 +348,7 @@ static Listener * open_listener( const char* url )
return NULL;
}
memcpy( &l.sl_addr.sin_addr, he->h_addr,
AC_MEMCPY( &l.sl_addr.sin_addr, he->h_addr,
sizeof( l.sl_addr.sin_addr ) );
}
}
@ -731,8 +731,8 @@ slapd_daemon_task(
}
}
#else
memcpy( &readfds, &slap_daemon.sd_readers, sizeof(fd_set) );
memcpy( &writefds, &slap_daemon.sd_writers, sizeof(fd_set) );
AC_MEMCPY( &readfds, &slap_daemon.sd_readers, sizeof(fd_set) );
AC_MEMCPY( &writefds, &slap_daemon.sd_writers, sizeof(fd_set) );
#endif
assert(!FD_ISSET(wake_sds[0], &readfds));
FD_SET( wake_sds[0], &readfds );

View File

@ -32,7 +32,7 @@ krbv4_ldap_auth(
Debug( LDAP_DEBUG_TRACE, "=> kerberosv4_ldap_auth\n", 0, 0, 0 );
SAFEMEMCPY( ktxt->dat, cred->bv_val, cred->bv_len );
AC_MEMCPY( ktxt->dat, cred->bv_val, cred->bv_len );
ktxt->length = cred->bv_len;
strcpy( instance, "*" );

View File

@ -125,7 +125,7 @@ mr_add(
int code;
smr = (MatchingRule *) ch_calloc( 1, sizeof(MatchingRule) );
memcpy( &smr->smr_mrule, mr, sizeof(LDAPMatchingRule));
AC_MEMCPY( &smr->smr_mrule, mr, sizeof(LDAPMatchingRule));
smr->smr_usage = usage;
smr->smr_convert = convert;

View File

@ -338,7 +338,7 @@ oc_add(
int code;
soc = (ObjectClass *) ch_calloc( 1, sizeof(ObjectClass) );
memcpy( &soc->soc_oclass, oc, sizeof(LDAPObjectClass) );
AC_MEMCPY( &soc->soc_oclass, oc, sizeof(LDAPObjectClass) );
if( soc->soc_sup_oids == NULL &&
soc->soc_kind == LDAP_SCHEMA_STRUCTURAL )

View File

@ -49,7 +49,7 @@ static char *v2ref( struct berval **ref, const char *text )
for( i=0; ref[i] != NULL; i++ ) {
v2 = ch_realloc( v2, len + ref[i]->bv_len + 1 );
v2[len-1] = '\n';
memcpy(&v2[len], ref[i]->bv_val, ref[i]->bv_len );
AC_MEMCPY(&v2[len], ref[i]->bv_val, ref[i]->bv_len );
len += ref[i]->bv_len;
if (ref[i]->bv_val[ref[i]->bv_len-1] != '/')
++len;

View File

@ -1666,7 +1666,7 @@ objectIdentifierFirstComponentMatch(
} else {
char *stored = ch_malloc( oid.bv_len + 1 );
memcpy( stored, oid.bv_val, oid.bv_len );
AC_MEMCPY( stored, oid.bv_val, oid.bv_len );
stored[oid.bv_len] = '\0';
if ( !strcmp( syntax->ssyn_oid, SLAP_SYNTAX_MATCHINGRULES_OID ) ) {

View File

@ -135,7 +135,7 @@ set_chase (SET_GATHER gatherer, void *cookie, char **set, char *attr, int attrle
set_dispose(set);
return(NULL);
}
memcpy(attrstr, attr, attrlen);
AC_MEMCPY(attrstr, attr, attrlen);
attrstr[attrlen] = 0;
nset = ch_calloc(1, sizeof(char *));
@ -287,7 +287,7 @@ set_filter (SET_GATHER gatherer, void *cookie, char *filter, char *user, char *t
*set = ch_calloc(len + 1, sizeof(char));
if (*set == NULL)
SF_ERROR(memory);
memcpy(*set, &filter[-len - 1], len);
AC_MEMCPY(*set, &filter[-len - 1], len);
SF_PUSH(set);
set = NULL;
break;

View File

@ -118,7 +118,7 @@ syn_add(
ssyn = (Syntax *) ch_calloc( 1, sizeof(Syntax) );
memcpy( &ssyn->ssyn_syn, syn, sizeof(LDAPSyntax) );
AC_MEMCPY( &ssyn->ssyn_syn, syn, sizeof(LDAPSyntax) );
ssyn->ssyn_next = NULL;

View File

@ -173,12 +173,12 @@ strtok_quote(
} else {
inquote = 1;
}
SAFEMEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
AC_MEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
break;
case '\\':
if ( next[1] )
SAFEMEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
AC_MEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
next++; /* dont parse the escaped character */
break;

View File

@ -184,7 +184,7 @@ Re_parse(
break;
case T_DN:
re->re_dn = ch_malloc( len + 1 );
memcpy( re->re_dn, value, len );
AC_MEMCPY( re->re_dn, value, len );
re->re_dn[ len ]='\0';
state |= GOT_DN;
break;
@ -234,7 +234,7 @@ Re_parse(
re->re_mods[ nml ].mi_type = strdup( type );
if ( value != NULL ) {
re->re_mods[ nml ].mi_val = ch_malloc( len + 1 );
memcpy( re->re_mods[ nml ].mi_val, value, len );
AC_MEMCPY( re->re_mods[ nml ].mi_val, value, len );
re->re_mods[ nml ].mi_val[ len ] = '\0';
re->re_mods[ nml ].mi_len = len;
} else {

View File

@ -173,7 +173,7 @@ addmodifyop( LDAPMod ***pmodsp, int modop, char *attr, char *value, int vlen )
perror( "malloc" );
exit( EXIT_FAILURE );
}
SAFEMEMCPY( bvp->bv_val, value, vlen );
AC_MEMCPY( bvp->bv_val, value, vlen );
bvp->bv_val[ vlen ] = '\0';
}
}