don't use strcpy
authorAndrew Tridgell <tridge@samba.org>
Fri, 7 Jan 2000 06:14:43 +0000 (06:14 +0000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 7 Jan 2000 06:14:43 +0000 (06:14 +0000)
(This used to be commit bf9b1328c5843eb217eff4ca05645498de2def82)

source3/tdb/tdb.c

index aec546a31081ec74803a1801e0ffda49be054e0f..eb751be32b53174d170fc16d698212982edc0351 100644 (file)
@@ -478,7 +478,8 @@ static int tdb_new_database(TDB_CONTEXT *tdb, int hash_size)
        int i;
 
        /* create the header */
-       strcpy(header.magic_food, TDB_MAGIC_FOOD);
+       memset(&header, 0, sizeof(header));
+       memcpy(header.magic_food, TDB_MAGIC_FOOD, strlen(TDB_MAGIC_FOOD)+1);
        header.version = TDB_VERSION;
        header.hash_size = hash_size;
        lseek(tdb->fd, 0, SEEK_SET);