summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/ereg/regex/regerror.c3
-rw-r--r--ext/hyperwave/hw.c6
-rw-r--r--ext/standard/file.c2
-rw-r--r--ext/zlib/zlib.c2
-rw-r--r--php4dll.dsp8
-rw-r--r--regex/regerror.c3
6 files changed, 15 insertions, 9 deletions
diff --git a/ext/ereg/regex/regerror.c b/ext/ereg/regex/regerror.c
index 12edd4e164..319f116896 100644
--- a/ext/ereg/regex/regerror.c
+++ b/ext/ereg/regex/regerror.c
@@ -94,8 +94,7 @@ size_t errbuf_size;
if (errbuf_size > len)
(void) strcpy(errbuf, s);
else {
- (void) strncpy(errbuf, s, errbuf_size-1);
- errbuf[errbuf_size-1] = '\0';
+ (void) strlcpy(errbuf, s, errbuf_size);
}
}
diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c
index 0ab5cd8091..8b4e13702f 100644
--- a/ext/hyperwave/hw.c
+++ b/ext/hyperwave/hw.c
@@ -579,7 +579,7 @@ static char * make_objrec_from_array(HashTable *lht) {
}
*ptr1++ = '\n';
*ptr1 = '\0';
- strncpy(str, ptr, 1023);
+ strlcpy(str, ptr, sizeof(str));
}
break;
}
@@ -1663,7 +1663,7 @@ PHP_FUNCTION(hw_modifyobject) {
ptr1[-1] = ':';
}
*ptr1 = '\0';
- strncpy(addattribute, ptr, BUFFERLEN);
+ strlcpy(addattribute, ptr, sizeof(addattribute));
noinsert = 0;
}
break;
@@ -1735,7 +1735,7 @@ PHP_FUNCTION(hw_modifyobject) {
}
*ptr1++ = '\n';
*ptr1 = '\0';
- strncpy(remattribute, ptr, BUFFERLEN);
+ strlcpy(remattribute, ptr, sizeof(remattribute));
noinsert = 0;
}
break;
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 930f05667b..ecd913856d 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -528,7 +528,7 @@ PHP_FUNCTION(tempnam)
convert_to_string(arg1);
convert_to_string(arg2);
d = estrndup(arg1->value.str.val,arg1->value.str.len);
- strncpy(p,arg2->value.str.val,sizeof(p));
+ strlcpy(p,arg2->value.str.val,sizeof(p));
t = tempnam(d,p);
efree(d);
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index ab763c1b11..79c8208583 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -206,7 +206,7 @@ static gzFile *php3_gzopen_with_path(char *filename, char *mode, char *path, cha
if(PG(doc_root)) {
snprintf(trypath, MAXPATHLEN, "%s%s", PG(doc_root), filename);
} else {
- strncpy(trypath,filename,MAXPATHLEN);
+ strlcpy(trypath,filename,sizeof(trypath));
}
if (!_php3_checkuid(trypath,2)) {
return(NULL);
diff --git a/php4dll.dsp b/php4dll.dsp
index 32755dde1a..f3ad32234e 100644
--- a/php4dll.dsp
+++ b/php4dll.dsp
@@ -153,6 +153,14 @@ SOURCE=.\safe_mode.c
SOURCE=.\SAPI.c
# End Source File
+# Begin Source File
+
+SOURCE=.\strlcat.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\strlcpy.c
+# End Source File
# End Group
# Begin Group "Header Files"
diff --git a/regex/regerror.c b/regex/regerror.c
index 12edd4e164..319f116896 100644
--- a/regex/regerror.c
+++ b/regex/regerror.c
@@ -94,8 +94,7 @@ size_t errbuf_size;
if (errbuf_size > len)
(void) strcpy(errbuf, s);
else {
- (void) strncpy(errbuf, s, errbuf_size-1);
- errbuf[errbuf_size-1] = '\0';
+ (void) strlcpy(errbuf, s, errbuf_size);
}
}