summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/cvs
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-01-20 02:52:51 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-01-20 02:52:51 +0000
commit429aa0f95fe415fd85c6b4e5fcfc974c7a4b2525 (patch)
treee5cab6cff22744c5baa460f76d03a6bf298e486a /gnu/usr.bin/cvs
parentb2aa197a56aab46a8e59978b089a67cfdff51ced (diff)
In dirswitch(), don't free dir_name until right before allocating
it again. This removes a potential double-free problem, whereby this function could free dir_name and then immediately return due to invalid directory syntax (without ever reassigning dir_name), then re-enter and free dir_name again. Fix from Stefan Esser.
Diffstat (limited to 'gnu/usr.bin/cvs')
-rw-r--r--gnu/usr.bin/cvs/src/server.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gnu/usr.bin/cvs/src/server.c b/gnu/usr.bin/cvs/src/server.c
index 762a6d72438..4a61b1dbf14 100644
--- a/gnu/usr.bin/cvs/src/server.c
+++ b/gnu/usr.bin/cvs/src/server.c
@@ -977,9 +977,6 @@ dirswitch (dir, repos)
return;
}
- if (dir_name != NULL)
- free (dir_name);
-
dir_len = strlen (dir);
/* Check for a trailing '/'. This is not ISDIRSEP because \ in the
@@ -995,6 +992,9 @@ dirswitch (dir, repos)
return;
}
+ if (dir_name != NULL)
+ free (dir_name);
+
dir_name = malloc (strlen (server_temp_dir) + dir_len + 40);
if (dir_name == NULL)
{