summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2000-02-13 15:56:07 +0000
committerAndi Gutmans <andi@php.net>2000-02-13 15:56:07 +0000
commit7441ee51757026543eb54abbb5a2e690ecc68f1f (patch)
treef2addf200663b3ab632a484e8ad4f327876886bf /ext
parent6ae0902498ab5e74162233dcd5d74f1b7039d33b (diff)
downloadphp-git-7441ee51757026543eb54abbb5a2e690ecc68f1f.tar.gz
- Beautify a bit.
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/string.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index ed847c4d82..3426a4bf85 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2149,7 +2149,7 @@ PHP_FUNCTION(parse_str)
int php_tag_find(char *tag, int len, char *set) {
char c, *n, *t;
int i=0, state=0, done=0;
- char *norm = emalloc(len);
+ char *norm = emalloc(len+1);
n = norm;
t = tag;
@@ -2184,8 +2184,11 @@ int php_tag_find(char *tag, int len, char *set) {
}
*(n++) = '>';
*n = '\0';
- if(strstr(set,norm)) done=1;
- else done=0;
+ if(strstr(set,norm)) {
+ done=1;
+ } else {
+ done=0;
+ }
efree(norm);
return done;
}
@@ -2265,8 +2268,8 @@ PHPAPI void php_strip_tags(char *rbuf, int len, int state, char *allow, int allo
if(allow) {
*(tp++) = '>';
*tp='\0';
- if(php_tag_find(tbuf, tp-tbuf+1, allow)) {
- memcpy(rp,tbuf,tp-tbuf+1);
+ if(php_tag_find(tbuf, tp-tbuf, allow)) {
+ memcpy(rp,tbuf,tp-tbuf);
rp += tp-tbuf;
}
tp = tbuf;