From 9cf096e1c1302303d217d69377b05cce9e061962 Mon Sep 17 00:00:00 2001 From: Jean-Francois Brousseau Date: Tue, 15 Feb 2005 15:17:35 +0000 Subject: avoid crashing when setting a variable with cvsd_set() that was not initialized with a dynamically-allocated string. spotted by mpech@ --- usr.bin/cvs/cvsd.c | 8 ++++---- usr.bin/cvs/sock.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'usr.bin/cvs') diff --git a/usr.bin/cvs/cvsd.c b/usr.bin/cvs/cvsd.c index 2083314b813..dea0e39cc02 100644 --- a/usr.bin/cvs/cvsd.c +++ b/usr.bin/cvs/cvsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cvsd.c,v 1.16 2004/12/14 19:53:12 xsa Exp $ */ +/* $OpenBSD: cvsd.c,v 1.17 2005/02/15 15:17:34 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -147,6 +147,7 @@ main(int argc, char **argv) struct group *grp; checkrepo = 0; + cvsd_set(CVSD_SET_SOCK, CVSD_SOCK_PATH); cvsd_set(CVSD_SET_USER, CVSD_USER); cvsd_set(CVSD_SET_GROUP, CVSD_GROUP); @@ -177,10 +178,10 @@ main(int argc, char **argv) checkrepo = 1; break; case 'r': - cvsd_root = optarg; + cvsd_set(CVSD_SET_ROOT, optarg); break; case 's': - cvsd_sock_path = optarg; + cvsd_set(CVSD_SET_SOCK, optarg); break; case 'u': cvsd_set(CVSD_SET_USER, optarg); @@ -870,7 +871,6 @@ cvsd_set(int what, ...) if (cvsd_sock_path != NULL) free(cvsd_sock_path); cvsd_sock_path = str; - error = cvsd_sock_open(); break; case CVSD_SET_USER: if (cvsd_user != NULL) diff --git a/usr.bin/cvs/sock.c b/usr.bin/cvs/sock.c index feedb9515ee..98435a1aea6 100644 --- a/usr.bin/cvs/sock.c +++ b/usr.bin/cvs/sock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sock.c,v 1.9 2005/01/27 20:45:18 jfb Exp $ */ +/* $OpenBSD: sock.c,v 1.10 2005/02/15 15:17:34 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -43,7 +43,7 @@ volatile sig_atomic_t cvs_sock_doloop; -char *cvsd_sock_path = CVSD_SOCK_PATH; +char *cvsd_sock_path; /* daemon API */ #ifdef CVSD -- cgit v1.2.3