cvs: pecl /http http_api.c
| From: | Michael Wallner | Date: | Wed, 23 Mar 2005 13:11:20 +0000 |
| Subject: | cvs: pecl /http http_api.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-2887@lists.php.net to get a copy of this message | ||
mike Wed Mar 23 08:11:20 2005 EDT
Modified files:
/pecl/http http_api.c
Log:
- improved range checking
http://cvs.php.net/diff.php/pecl/http/http_api.c?r1=1.65&r2=1.66&ty=u
Index: pecl/http/http_api.c
diff -u pecl/http/http_api.c:1.65 pecl/http/http_api.c:1.66
--- pecl/http/http_api.c:1.65 Mon Mar 21 14:33:37 2005
+++ pecl/http/http_api.c Wed Mar 23 08:11:19 2005
@@ -13,7 +13,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: http_api.c,v 1.65 2005/03/21 19:33:37 mike Exp $ */
+/* $Id: http_api.c,v 1.66 2005/03/23 13:11:19 mike Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -286,7 +286,7 @@
char *pretty_key(char *key, size_t key_len, zend_bool uctitle, zend_bool xhyphen)
{
if (key && key_len) {
- int i, wasalpha;
+ unsigned i, wasalpha;
if (wasalpha = isalpha(key[0])) {
key[0] = uctitle ? toupper(key[0]) : tolower(key[0]);
}
@@ -1159,7 +1159,8 @@
{
/* "0-12345" */
case -10:
- if (length <= end) {
+ /* "0-", "0-0" or overflow */
+ if (end == -1 || end == -10 || length <= end) {
return RANGE_ERR;
}
begin = 0;
@@ -1167,7 +1168,8 @@
/* "-12345" */
case -1:
- if (length <= end) {
+ /* "-", "-0" or overflow */
+ if (end == -1 || end == -10 || length <= end) {
return RANGE_ERR;
}
begin = length - end;
@@ -1178,6 +1180,11 @@
default:
switch (end)
{
+ /* "12345-0" */
+ case -10:
+ return RANGE_ERR;
+ break;
+
/* "12345-" */
case -1:
if (length <= begin) {