]> granicus.if.org Git - php/commitdiff
fix #41394 (dbase_create creates file with corrupted header)
authorAntony Dovgal <tony2001@php.net>
Wed, 16 May 2007 13:16:56 +0000 (13:16 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 16 May 2007 13:16:56 +0000 (13:16 +0000)
ext/dbase/dbf_head.c

index 9c9363dfbbe31ebe3754d88cebde5a4005516a60..33e3a425d742b3609b5e653a8259fc5c2154c06c 100644 (file)
@@ -184,7 +184,7 @@ int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
        /* build the on disk field info */
        scp = dbf->db_fname; dcp = dbfield.dbf_name;
 
-       strncpy(dbfield.dbf_name, dbf->db_fname, DBF_NAMELEN);
+       strlcpy(dbfield.dbf_name, dbf->db_fname, DBF_NAMELEN + 1);
 
        dbfield.dbf_type = dbf->db_type;
        switch (dbf->db_type) {
@@ -215,7 +215,7 @@ void put_dbf_info(dbhead_t *dbh)
        int             fcnt;
 
        if ((cp = db_cur_date(NULL))) {
-               strlcpy(dbh->db_date, cp, 8);
+               strlcpy(dbh->db_date, cp, 9);
                free(cp);
        }
        put_dbf_head(dbh);