]> granicus.if.org Git - php/commitdiff
- Thread-unsafe win32 compiles again
authorAndi Gutmans <andi@php.net>
Wed, 15 Sep 1999 05:42:36 +0000 (05:42 +0000)
committerAndi Gutmans <andi@php.net>
Wed, 15 Sep 1999 05:42:36 +0000 (05:42 +0000)
- Some strlcpy changes including one bug fix.

ext/ereg/regex/regerror.c
ext/hyperwave/hw.c
ext/standard/file.c
ext/zlib/zlib.c
php4dll.dsp
regex/regerror.c

index 12edd4e16499471e7cdf2f771a4d63da1d21c44b..319f1168963ad132e0bd92160f210cfa03729597 100644 (file)
@@ -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);
                }
        }
 
index 0ab5cd8091e3d0ad20e639d4e1802bc2e6dc4d73..8b4e13702f406744668563e0027eb08a135d4b9b 100644 (file)
@@ -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;
index 930f05667baabfe4a10b1a05c037d2dfa25681d0..ecd913856db04858f35c31a67d0c4c254fbf203a 100644 (file)
@@ -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);
index ab763c1b117e1f29c82607afb2dcbf6b4b161c08..79c820858360821a6844365f33a37f1057e63460 100644 (file)
@@ -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);
index 32755dde1a1c219a7341baff6bd29d4c057abc0e..f3ad32234e564b73c00a1518820c4f31e4fcad19 100644 (file)
@@ -153,6 +153,14 @@ SOURCE=.\safe_mode.c
 \r
 SOURCE=.\SAPI.c\r
 # End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\strlcat.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\strlcpy.c\r
+# End Source File\r
 # End Group\r
 # Begin Group "Header Files"\r
 \r
index 12edd4e16499471e7cdf2f771a4d63da1d21c44b..319f1168963ad132e0bd92160f210cfa03729597 100644 (file)
@@ -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);
                }
        }