diff options
author | 2007-09-10 10:29:12 +0000 | |
---|---|---|
committer | 2007-09-10 10:29:12 +0000 | |
commit | 786b9ba318d35c4a3d05821354a363b103bcd5c7 (patch) | |
tree | a427074e26cfeb2a35b72871ca8858e685ece87b | |
parent | optional flags must be sorted and enclosed in single brackets, (diff) | |
download | wireguard-openbsd-786b9ba318d35c4a3d05821354a363b103bcd5c7.tar.xz wireguard-openbsd-786b9ba318d35c4a3d05821354a363b103bcd5c7.zip |
Fixed segmentation fault that occured during .cvsrc parsing if an invalid
cvs command has been specified.
Spotted by Mathias De Belder <mathias at woei dot be> who also supplied a
patch, although I took his second suggestion.
OK joris@
-rw-r--r-- | usr.bin/cvs/cvs.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c index 9d4c3270c00..3c860bfa35d 100644 --- a/usr.bin/cvs/cvs.c +++ b/usr.bin/cvs/cvs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.c,v 1.131 2007/09/07 23:30:30 tobias Exp $ */ +/* $OpenBSD: cvs.c,v 1.132 2007/09/10 10:29:12 tobias Exp $ */ /* * Copyright (c) 2006, 2007 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -184,6 +184,16 @@ main(int argc, char **argv) else if (!S_ISDIR(st.st_mode)) fatal("`%s' is not valid temporary directory", cvs_tmpdir); + cmdp = cvs_findcmd(cvs_command); + if (cmdp == NULL) { + fprintf(stderr, "Unknown command: `%s'\n\n", cvs_command); + fprintf(stderr, "CVS commands are:\n"); + for (i = 0; cvs_cdt[i] != NULL; i++) + fprintf(stderr, "\t%-16s%s\n", + cvs_cdt[i]->cmd_name, cvs_cdt[i]->cmd_descr); + exit(1); + } + if (cvs_readrc == 1 && cvs_homedir != NULL) { cvs_read_rcfile(); @@ -206,16 +216,6 @@ main(int argc, char **argv) signal(SIGALRM, sighandler); signal(SIGPIPE, sighandler); - cmdp = cvs_findcmd(cvs_command); - if (cmdp == NULL) { - fprintf(stderr, "Unknown command: `%s'\n\n", cvs_command); - fprintf(stderr, "CVS commands are:\n"); - for (i = 0; cvs_cdt[i] != NULL; i++) - fprintf(stderr, "\t%-16s%s\n", - cvs_cdt[i]->cmd_name, cvs_cdt[i]->cmd_descr); - exit(1); - } - cvs_cmdop = cmdp->cmd_op; cmd_argc = 0; |