com php-src: fix loop - size_t is unsigned so can n ot be negative: ext/standard/ftp_fopen_wrapper.c
| From: | Stanislav Malyshev | Date: | Wed, 12 Nov 2014 00:34:50 +0000 |
| Subject: | com php-src: fix loop - size_t is unsigned so can n ot be negative: ext/standard/ftp_fopen_wrapper.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-83032@lists.php.net to get a copy of this message | ||
Commit: 32fd4590a5b9572e90548ce3d251defc3f6c4421
Author: Stanislav Malyshev <stas@php.net> Tue, 4 Nov 2014 21:58:44 -0800
Parents: cf468b0f5c0d31cf1e36291d3d5c3781149e0183
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=32fd4590a5b9572e90548ce3d251defc3f6c4421
Log:
fix loop - size_t is unsigned so can not be negative
Changed paths:
M ext/standard/ftp_fopen_wrapper.c
Diff:
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index ed93345..01522bc 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -635,11 +635,10 @@ static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t
count
zend_string_release(basename);
/* Trim off trailing whitespace characters */
- tmp_len--;
while (tmp_len > 0 &&
- (ent->d_name[tmp_len] == '\n' || ent->d_name[tmp_len] == '\r' ||
- ent->d_name[tmp_len] == '\t' || ent->d_name[tmp_len] == ' ')) {
- ent->d_name[tmp_len--] = '\0';
+ (ent->d_name[tmp_len - 1] == '\n' || ent->d_name[tmp_len - 1] == '\r'
||
+ ent->d_name[tmp_len - 1] == '\t' || ent->d_name[tmp_len - 1] == ' '))
{
+ ent->d_name[--tmp_len] = '\0';
}
return sizeof(php_stream_dirent);