[PHP-DEV] CVS update: php3/functions From: zeev (php-dev <email protected>)
Date: 05/30/98

Date: Saturday May 30, 1998 @ 10:28
Author: zeev

Update of /repository/php3/functions
In directory asf:/tmp/cvs-serv4593/functions

Modified Files:
        reg.c
Log Message:
Fix reg.c strncat()'s (one is left, it's too complicated for me to figure out :)

Index: php3/functions/reg.c
diff -c php3/functions/reg.c:1.80 php3/functions/reg.c:1.81
*** php3/functions/reg.c:1.80 Sat May 30 09:38:31 1998
--- php3/functions/reg.c Sat May 30 10:28:26 1998
***************
*** 28,34 ****
     | Jaakko Hyvätti <jaakko <email protected>> |
     +----------------------------------------------------------------------+
   */
! /* $Id: reg.c,v 1.80 1998/05/30 13:38:31 rasmus Exp $ */
  #ifdef THREAD_SAFE
  #include "tls.h"
  #endif
--- 28,34 ----
     | Jaakko Hyvätti <jaakko <email protected>> |
     +----------------------------------------------------------------------+
   */
! /* $Id: reg.c,v 1.81 1998/05/30 14:28:26 zeev Exp $ */
  #ifdef THREAD_SAFE
  #include "tls.h"
  #endif
***************
*** 82,91 ****
          len = regerror(err, re, NULL, 0);
          if (len) {
                  message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
! if (!message) return; /* fail silently */
                  if (buf_len) {
! strncat(message, buf, buf_len);
! strcat(message, ": ");
                          buf_len += 1; /* so pointer math below works */
                  }
                  /* drop the message into place */
--- 82,92 ----
          len = regerror(err, re, NULL, 0);
          if (len) {
                  message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
! if (!message) {
! return; /* fail silently */
! }
                  if (buf_len) {
! snprintf(message, buf_len, "%s: ", buf);
                          buf_len += 1; /* so pointer math below works */
                  }
                  /* drop the message into place */
***************
*** 182,192 ****
                  array_init(array);
  
                  for (i = 0; i < NS; i++) {
- *buf = '\0';
                          start = subs[i].rm_so;
                          end = subs[i].rm_eo;
                          if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) {
! strncat(buf, &string[start], end - start);
                                  entry.value.str.len = end - start;
                                  entry.value.str.val = estrdup(buf);
                                  entry.type = IS_STRING;
--- 183,192 ----
                  array_init(array);
  
                  for (i = 0; i < NS; i++) {
                          start = subs[i].rm_so;
                          end = subs[i].rm_eo;
                          if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) {
! strncpy(buf, &string[start], end - start);
                                  entry.value.str.len = end - start;
                                  entry.value.str.val = estrdup(buf);
                                  entry.type = IS_STRING;