]> git.sur5r.net Git - openldap/commitdiff
use AC_MEMCPY instead of str[n]cpy
authorPierangelo Masarati <ando@openldap.org>
Mon, 22 Oct 2001 09:39:02 +0000 (09:39 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 22 Oct 2001 09:39:02 +0000 (09:39 +0000)
libraries/librewrite/map.c
libraries/librewrite/rule.c
libraries/librewrite/subst.c

index c40456aa9cc6d5a366c078428fce44392b79d74a..c1fc47d3a8be582f7957f067d63a9b1df1c4d1ee 100644 (file)
@@ -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;
 
        /*
index 84a652daf416634f86360b1fb075566b773a1c26..c8a1c07a14dca4379d45a31a57ef3ed901b1caa2 100644 (file)
@@ -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 ) );
index 2715da1ce757f25e74d1da995123e4490c1f1be8..df0414aca32b21ff92519bea6cb70c13fd24735a 100644 (file)
@@ -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;