[php-i18n-commits] cvs commit: php4/ext/mbstring mbfunction.c

アーカイブの一覧に戻る

Tsukada ttsuk****@users*****
2002年 5月 26日 (日) 18:23:22 JST


ttsukada    02/05/26 18:23:22

  Modified:    ext/mbstring mbfunction.c
  Log:
  fixed unsigned subtraction in php_mb_strpos()
  
  Revision  Changes    Path
  1.7       +8 -2      php4/ext/mbstring/mbfunction.c
  
  Index: mbfunction.c
  ===================================================================
  RCS file: /cvsroot/php-i18n/php4/ext/mbstring/mbfunction.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- mbfunction.c	26 May 2002 06:11:48 -0000	1.6
  +++ mbfunction.c	26 May 2002 09:23:22 -0000	1.7
  @@ -1015,7 +1015,11 @@
   				pc->found_pos++;
   				p = h;
   				m = pc->needle->value;
  -				n = pc->needle_pos - 1;
  +				if (pc->needle_pos > 0) {
  +					n = pc->needle_pos - 1;
  +				} else {
  +					n = 0;
  +				}
   				while (n > 0 && *p == *m) {
   					n--;
   					p++;
  @@ -1103,7 +1107,9 @@
   		p++;
   		n--;
   	}
  -	if (cd.flag == 0) {
  +	if (offset >= cd.output) {
  +		PHP_MB_ERRSET(PHP_MB_ERR_INDEX_OUT_OF_BOUNDS);
  +	} else if (cd.flag == 0) {
   		PHP_MB_ERRSET(PHP_MB_ERR_NOT_FOUND);
   	}
   	php_mb_conv_filt_flush(filter);
  
  
  



php-i18n-commits メーリングリストの案内
アーカイブの一覧に戻る