SF Bug Tracker id 3497027 - Buffer not null terminated in parse_hostport

Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 06:28:38 PST

workbuf might be not null terminated.
(cherry picked from commit 40864da7c134fe91b00c30f0ea3081f8f4cf28ef)
This commit is contained in:
Fabrice Fontaine 2012-03-05 16:29:44 +01:00 committed by Marcelo Roberto Jimenez
parent a0951e3753
commit 898fb30183
2 changed files with 10 additions and 1 deletions

View File

@ -299,6 +299,14 @@ Version 1.8.0
Version 1.6.16
*******************************************************************************
2012-03-05 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
SF Bug Tracker id 3497027 - Buffer not null terminated in parse_hostport
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 06:28:38 PST
workbuf might be not null terminated.
2012-03-05 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
SF Bug Tracker id 3497009 - Resource leak in http_SendMessage

View File

@ -329,8 +329,9 @@ int parse_hostport(
int ret;
memset(out, 0, sizeof(hostport_type));
memset(workbuf, 0, sizeof(workbuf);
/* Work on a copy of the input string. */
strncpy(workbuf, in, sizeof(workbuf));
strncpy(workbuf, in, sizeof(workbuf) - 1);
c = workbuf;
if (*c == '[') {
/* IPv6 addresses are enclosed in square brackets. */