blob: 3a6f94ad5bcb0d23d4110a12cbb496d1de15cc0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
Backported from 5.6.25 by Remi.
From 9c291f0fa0c8b8c6994f521f5863c407494eb1dc Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev <stas@php.net>
Date: Wed, 3 Aug 2016 22:59:01 -0700
Subject: [PATCH] Fix bug #72716 - initialize buffer before read
---
ext/standard/ftp_fopen_wrapper.c | 81 ++++++++++++++++++++--------------------
1 file changed, 41 insertions(+), 40 deletions(-)
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index b7eeb56..0d5384e 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -82,6 +82,7 @@ typedef struct _php_ftp_dirstream_data {
*/
static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size TSRMLS_DC)
{
+ buffer[0] = '\0'; /* in case read fails to read anything */
while (php_stream_gets(stream, buffer, buffer_size-1) &&
!(isdigit((int) buffer[0]) && isdigit((int) buffer[1]) &&
isdigit((int) buffer[2]) && buffer[3] == ' '));
|