mirror of
https://github.com/php/php-src.git
synced 2024-09-23 02:47:26 +00:00
fix invalid read when trimming empty string
This commit is contained in:
parent
964acdaa35
commit
5b82fb52fd
@ -109,8 +109,10 @@
|
|||||||
if (len < 1 && return_if_empty) { \
|
if (len < 1 && return_if_empty) { \
|
||||||
RETURN_VALIDATION_FAILED \
|
RETURN_VALIDATION_FAILED \
|
||||||
} \
|
} \
|
||||||
while (p[len-1] == ' ' || p[len-1] == '\t' || p[len-1] == '\r' || p[len-1] == '\v' || p[len-1] == '\n') { \
|
if (len > 0) { \
|
||||||
len--; \
|
while (p[len-1] == ' ' || p[len-1] == '\t' || p[len-1] == '\r' || p[len-1] == '\v' || p[len-1] == '\n') { \
|
||||||
|
len--; \
|
||||||
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user