php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #68289
Patch patchstrlcpy.diff revision 2014-10-23 07:00 UTC by otto at drijf dot net

Patch patchstrlcpy.diff for dbase Bug #68289

Patch version 2014-10-23 07:00 UTC

Return to Bug #68289 | Download this patch
Patch Revisions:

Developer: otto@drijf.net

diff -u dbase-5.1.0/dbf_rec.c dbase-5.1.0.fixed/dbf_rec.c
--- dbase-5.1.0/dbf_rec.c	Wed Jun 13 03:44:07 2012
+++ dbase-5.1.0.fixed/dbf_rec.c	Wed Oct 22 16:46:06 2014
@@ -152,7 +152,8 @@
 	if ( !cp )
 		cp = (char *)malloc(flen + 1);
 	if ( cp ) {
-		strlcpy(cp, &rp[fldp->db_foffset], flen + 1);
+		strncpy(cp, &rp[fldp->db_foffset], flen);
+		cp[flen] = 0;
 	}
 	return cp;
 }
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Feb 25 01:01:24 2020 UTC