From 65a82cc0f25cba90154853d208d0829ededf17b6 Mon Sep 17 00:00:00 2001 From: "Alexey I. Froloff" Date: Wed, 27 Aug 2008 22:20:31 +0400 Subject: [PATCH] Fix a memory corruption (altbug #14929). --- apt/cmdline/apt-get.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apt/cmdline/apt-get.cc b/apt/cmdline/apt-get.cc index 1671f58..730f6f5 100644 --- a/apt/cmdline/apt-get.cc +++ b/apt/cmdline/apt-get.cc @@ -3247,7 +3247,9 @@ int main(int argc,const char *argv[]) if (strstr(*I, "://") != NULL) { URLLst.push_back(*I); - *I = strrchr(*I, '/')+1; + const char *N = strdup(strrchr(*I, '/')+1); + free((void *)*I); + *I = N; } }