[PHP-DEV] CVS update: php3/functions From: sas (php-dev <email protected>)
Date: 12/28/98

Date: Monday December 28, 1998 @ 14:05
Author: sas

Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv8087

Modified Files:
        string.c
Log Message:
make chunk_split binary safe

Index: php3/functions/string.c
diff -c php3/functions/string.c:1.158 php3/functions/string.c:1.159
*** php3/functions/string.c:1.158 Mon Dec 21 00:24:20 1998
--- php3/functions/string.c Mon Dec 28 14:05:19 1998
***************
*** 30,36 ****
   */
  
  
! /* $Id: string.c,v 1.158 1998/12/21 05:24:20 sas Exp $ */
  #ifdef THREAD_SAFE
  #include "tls.h"
  #endif
--- 30,36 ----
   */
  
  
! /* $Id: string.c,v 1.159 1998/12/28 19:05:19 sas Exp $ */
  #ifdef THREAD_SAFE
  #include "tls.h"
  #endif
***************
*** 523,529 ****
  /* }}} */
  
  
! /* case-insensitve strstr */
  PHPAPI char *php3i_stristr(unsigned char *s, unsigned char *t)
  {
          int i, j, k, l;
--- 523,529 ----
  /* }}} */
  
  
! /* case insensitive strstr */
  PHPAPI char *php3i_stristr(unsigned char *s, unsigned char *t)
  {
          int i, j, k, l;
***************
*** 711,717 ****
  /* }}} */
  
  static char *
! _php3_chunk_split(char *src, int srclen, char *end, int endlen, int chunklen)
  {
          char *dest;
          char *p, *q;
--- 711,718 ----
  /* }}} */
  
  static char *
! _php3_chunk_split(char *src, int srclen, char *end, int endlen,
! int chunklen, int *destlen)
  {
          char *dest;
          char *p, *q;
***************
*** 739,744 ****
--- 740,746 ----
          }
  
          *q = '\0';
+ if(destlen) *destlen = q - dest;
  
          return(dest);
  }
***************
*** 753,766 ****
          char *end = "\r\n";
          int endlen = 2;
          int chunklen = 76;
          TLS_VARS;
  
          argc = ARG_COUNT(ht);
!
! if(!((argc == 1 && getParameters(ht, 1, &p_str) != FAILURE) ||
! (argc == 2 && getParameters(ht, 2, &p_str, &p_chunklen) != FAILURE) ||
! (argc == 3 && getParameters(ht, 3, &p_str, &p_chunklen,
! &p_ending) != FAILURE))) {
                  WRONG_PARAM_COUNT;
          }
          
--- 755,767 ----
          char *end = "\r\n";
          int endlen = 2;
          int chunklen = 76;
+ int result_len;
          TLS_VARS;
  
          argc = ARG_COUNT(ht);
!
! if(argc < 1 || argc > 3 || getParameters(ht, argc, &p_str,
! &p_chunklen, &p_ending) == FAILURE) {
                  WRONG_PARAM_COUNT;
          }
          
***************
*** 782,791 ****
          }
          
          result = _php3_chunk_split(p_str->value.str.val, p_str->value.str.len,
! end, endlen, chunklen);
          
          if(result) {
! RETVAL_STRING(result, 0);
          } else {
                  RETURN_FALSE;
          }
--- 783,792 ----
          }
          
          result = _php3_chunk_split(p_str->value.str.val, p_str->value.str.len,
! end, endlen, chunklen, &result_len);
          
          if(result) {
! RETVAL_STRINGL(result, result_len, 0);
          } else {
                  RETURN_FALSE;
          }

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>