Avoid using freed memory when using URLs and a proxy.
This commit is contained in:
parent
3d9b4a4320
commit
14f785118c
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: fetch.c,v 1.27 1998/08/03 01:49:25 lukem Exp $ */
|
/* $NetBSD: fetch.c,v 1.28 1998/08/03 19:10:29 fvdl Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
__RCSID("$NetBSD: fetch.c,v 1.27 1998/08/03 01:49:25 lukem Exp $");
|
__RCSID("$NetBSD: fetch.c,v 1.28 1998/08/03 19:10:29 fvdl Exp $");
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -213,6 +213,7 @@ url_get(url, proxyenv, outfile)
|
|||||||
size_t len;
|
size_t len;
|
||||||
char *cp, *ep;
|
char *cp, *ep;
|
||||||
const char *savefile;
|
const char *savefile;
|
||||||
|
char *psavefile;
|
||||||
char *buf;
|
char *buf;
|
||||||
volatile sig_t oldintr, oldintp;
|
volatile sig_t oldintr, oldintp;
|
||||||
off_t hashbytes;
|
off_t hashbytes;
|
||||||
@ -228,6 +229,7 @@ url_get(url, proxyenv, outfile)
|
|||||||
|
|
||||||
closefunc = NULL;
|
closefunc = NULL;
|
||||||
fin = fout = NULL;
|
fin = fout = NULL;
|
||||||
|
psavefile = NULL;
|
||||||
s = -1;
|
s = -1;
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
isredirected = isproxy = 0;
|
isredirected = isproxy = 0;
|
||||||
@ -240,6 +242,8 @@ url_get(url, proxyenv, outfile)
|
|||||||
(void)&buf;
|
(void)&buf;
|
||||||
(void)&savefile;
|
(void)&savefile;
|
||||||
(void)&retval;
|
(void)&retval;
|
||||||
|
(void)&psavefile;
|
||||||
|
(void)&isproxy;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (parse_url(url, "URL", &urltype, &user, &pass, &host, &port, &path)
|
if (parse_url(url, "URL", &urltype, &user, &pass, &host, &port, &path)
|
||||||
@ -368,6 +372,8 @@ url_get(url, proxyenv, outfile)
|
|||||||
port = httpport;
|
port = httpport;
|
||||||
else
|
else
|
||||||
port = pport;
|
port = pport;
|
||||||
|
psavefile = strdup(savefile);
|
||||||
|
savefile = psavefile;
|
||||||
FREEPTR(path);
|
FREEPTR(path);
|
||||||
FREEPTR(ppath);
|
FREEPTR(ppath);
|
||||||
path = xstrdup(url);
|
path = xstrdup(url);
|
||||||
@ -654,6 +660,7 @@ cleanup_url_get:
|
|||||||
close(s);
|
close(s);
|
||||||
if (closefunc != NULL && fout != NULL)
|
if (closefunc != NULL && fout != NULL)
|
||||||
(*closefunc)(fout);
|
(*closefunc)(fout);
|
||||||
|
FREEPTR(psavefile);
|
||||||
FREEPTR(user);
|
FREEPTR(user);
|
||||||
FREEPTR(pass);
|
FREEPTR(pass);
|
||||||
FREEPTR(host);
|
FREEPTR(host);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user