From: Pierangelo Masarati Date: Mon, 22 Oct 2001 09:39:02 +0000 (+0000) Subject: use AC_MEMCPY instead of str[n]cpy X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~955 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=03a97678ea52a506b20b38d6e07d15f25c398a44;p=openldap use AC_MEMCPY instead of str[n]cpy --- diff --git a/libraries/librewrite/map.c b/libraries/librewrite/map.c index c40456aa9c..c1fc47d3a8 100644 --- a/libraries/librewrite/map.c +++ b/libraries/librewrite/map.c @@ -123,7 +123,7 @@ rewrite_xmap_parse( l = p - s - c; filename = calloc( sizeof( char ), l + 1 ); - strncpy( filename, s + c, l ); + AC_MEMCPY( filename, s + c, l ); filename[ l ] = '\0'; map->lm_args = ( void * )fopen( filename, "r" ); @@ -177,7 +177,7 @@ rewrite_xmap_parse( */ l = p - s - c; url = calloc( sizeof( char ), l + 3 ); - strncpy( url, s + c, l ); + AC_MEMCPY( url, s + c, l ); url[ l ] = '\0'; /* @@ -270,7 +270,7 @@ rewrite_map_parse( */ l = p - string - 1; s = calloc( sizeof( char ), l + 1 ); - strncpy( s, string, l ); + AC_MEMCPY( s, string, l ); s[ l ] = 0; /* diff --git a/libraries/librewrite/rule.c b/libraries/librewrite/rule.c index 84a652daf4..c8a1c07a14 100644 --- a/libraries/librewrite/rule.c +++ b/libraries/librewrite/rule.c @@ -205,7 +205,7 @@ rewrite_rule_compile( /* XXX Need to free stuff */ return REWRITE_ERR; } - strncpy( buf, p + 2, l ); + AC_MEMCPY( buf, p + 2, l ); buf[ l ] = '\0'; d = malloc( sizeof( int ) ); diff --git a/libraries/librewrite/subst.c b/libraries/librewrite/subst.c index 2715da1ce7..df0414aca3 100644 --- a/libraries/librewrite/subst.c +++ b/libraries/librewrite/subst.c @@ -91,7 +91,7 @@ rewrite_subst_compile( if ( subs[ nsub - 1 ]->bv_val == NULL ) { return NULL; } - strncpy( subs[ nsub - 1 ]->bv_val, begin, l ); + AC_MEMCPY( subs[ nsub - 1 ]->bv_val, begin, l ); subs[ nsub - 1 ]->bv_val[ l ] = '\0'; } else { subs[ nsub - 1 ] = NULL; @@ -202,7 +202,7 @@ rewrite_subst_compile( subs_len += l; subs[ nsub ]->bv_len = l; subs[ nsub ]->bv_val = malloc( l + 1 ); - strncpy( subs[ nsub ]->bv_val, begin, l ); + AC_MEMCPY( subs[ nsub ]->bv_val, begin, l ); subs[ nsub ]->bv_val[ l ] = '\0'; } else { subs[ nsub ] = NULL; @@ -255,7 +255,7 @@ submatch_copy( return REWRITE_ERR; } - strncpy( val->bv_val, s, l ); + AC_MEMCPY( val->bv_val, s, l ); val->bv_val[ l ] = '\0'; return REWRITE_SUCCESS; @@ -410,15 +410,18 @@ rewrite_subst_apply( */ for ( n = 0, cl = 0; n < subst->lt_num_submatch; n++ ) { if ( subst->lt_subs[ n ] != NULL ) { - strcpy( res + cl, subst->lt_subs[ n ]->bv_val); + AC_MEMCPY( res + cl, subst->lt_subs[ n ]->bv_val, + subst->lt_subs[ n ]->bv_len ); cl += subst->lt_subs[ n ]->bv_len; } - strcpy( res + cl, submatch[ n ].bv_val ); + AC_MEMCPY( res + cl, submatch[ n ].bv_val, + submatch[ n ].bv_len ); cl += submatch[ n ].bv_len; free( submatch[ n ].bv_val ); } if ( subst->lt_subs[ n ] != NULL ) { - strcpy( res + cl, subst->lt_subs[ n ]->bv_val ); + AC_MEMCPY( res + cl, subst->lt_subs[ n ]->bv_val, + subst->lt_subs[ n ]->bv_len ); } val->bv_val = res;