]> git.sur5r.net Git - openldap/commitdiff
Avoid questionable use of strlen(), strcpy(), and strcat().
authorKurt Zeilenga <kurt@openldap.org>
Mon, 20 Oct 2003 22:23:11 +0000 (22:23 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 20 Oct 2003 22:23:11 +0000 (22:23 +0000)
servers/slapd/syncrepl.c

index b13253a9430445fdef2204aa7438cff85359c7fb..b786bbe9b731858380d9db257102bb63abb0559d 100644 (file)
@@ -865,11 +865,13 @@ syncrepl_entry(
                }
        }
 
-       op->ors_filterstr.bv_len = strlen("entryUUID=") + syncUUID->bv_len;
-       op->ors_filterstr.bv_val = (char *) sl_malloc( op->ors_filterstr.bv_len + 1,
-                                                                       op->o_tmpmemctx ); 
-       strcpy( op->ors_filterstr.bv_val, "entryUUID=" );
-       strcat( op->ors_filterstr.bv_val, syncUUID->bv_val );
+       op->ors_filterstr.bv_len = (sizeof("entryUUID=")-1) + syncUUID->bv_len;
+       op->ors_filterstr.bv_val = (char *) sl_malloc(
+               op->ors_filterstr.bv_len + 1, op->o_tmpmemctx ); 
+       AC_MEMCPY( op->ors_filterstr.bv_val, "entryUUID=", sizeof("entryUUID=")-1 );
+       AC_MEMCPY( &op->ors_filterstr.bv_val[sizeof("entryUUID=")-1],
+               syncUUID->bv_val, syncUUID->bv_len );
+       op->ors_filterstr.bv_val[op->ors_filterstr.bv_len] = '\0';
 
        si->e = e;
        si->syncUUID_ndn = NULL;