From: Antony Dovgal Date: Wed, 16 May 2007 13:16:56 +0000 (+0000) Subject: fix #41394 (dbase_create creates file with corrupted header) X-Git-Tag: RELEASE_1_2_0~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26c0270d57c41bb8ecfd5dc8dc3b9418411516fd;p=php fix #41394 (dbase_create creates file with corrupted header) --- diff --git a/ext/dbase/dbf_head.c b/ext/dbase/dbf_head.c index 9c9363dfbb..33e3a425d7 100644 --- a/ext/dbase/dbf_head.c +++ b/ext/dbase/dbf_head.c @@ -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);