File: 0003-fix-Invalid-write-of-size-1.patch

package info (click to toggle)
php-ssh2 1.0%2B0.13-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 556 kB
  • ctags: 474
  • sloc: ansic: 5,821; xml: 418; pascal: 22; makefile: 1
file content (22 lines) | stat: -rw-r--r-- 840 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
From: Remi Collet <remi@php.net>
Date: Thu, 10 Nov 2016 09:33:25 +0100
Subject: fix Invalid write of size 1

---
 ssh2-1.0/ssh2_fopen_wrappers.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ssh2-1.0/ssh2_fopen_wrappers.c b/ssh2-1.0/ssh2_fopen_wrappers.c
index f01a9e3..527da4a 100644
--- a/ssh2-1.0/ssh2_fopen_wrappers.c
+++ b/ssh2-1.0/ssh2_fopen_wrappers.c
@@ -220,7 +220,8 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre
 	if (h) {
 		/* Starting with 5.6.28, 7.0.13 need to be clean, else php_url_parse will fail */
 		char *tmp = estrdup(path);
-		strncpy(tmp + (h-path), h + sizeof("Resource id #")-1, strlen(tmp));
+
+		strncpy(tmp + (h-path), h + sizeof("Resource id #")-1, strlen(tmp)-sizeof("Resource id #"));
 		resource = php_url_parse(tmp);
 		efree(tmp);
 	} else {