From: dtucker Date: Fri, 8 Jan 2010 07:55:58 +0000 (+0000) Subject: - stevesk@cvs.openbsd.org 2009/12/25 19:40:21 X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/commitdiff_plain/9e622dcd140cc9676d1414db44712e3a1b7c4c18?hp=f67f71f13830a2ac281f3ea2e0649aa4e3814aa7 - stevesk@cvs.openbsd.org 2009/12/25 19:40:21 [readconf.c servconf.c misc.h ssh-keyscan.c misc.c] validate routing domain is in range 0-RT_TABLEID_MAX. 'Looks right' deraadt@ --- diff --git a/ChangeLog b/ChangeLog index ce5cd8b8..feaa27ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -123,6 +123,10 @@ [PROTOCOL] fix an incorrect magic number and typo in PROTOCOL; bz#1688 report and fix from ueno AT unixuser.org + - stevesk@cvs.openbsd.org 2009/12/25 19:40:21 + [readconf.c servconf.c misc.h ssh-keyscan.c misc.c] + validate routing domain is in range 0-RT_TABLEID_MAX. + 'Looks right' deraadt@ 20091226 - (tim) [contrib/cygwin/Makefile] Install ssh-copy-id and ssh-copy-id.1 diff --git a/misc.c b/misc.c index 21db00a1..d4bdfc0e 100644 --- a/misc.c +++ b/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.73 2009/11/20 03:24:07 djm Exp $ */ +/* $OpenBSD: misc.c,v 1.74 2009/12/25 19:40:21 stevesk Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2005,2006 Damien Miller. All rights reserved. @@ -273,6 +273,18 @@ a2port(const char *s) return (int)port; } +int +a2rdomain(const char *s) +{ + long long rdomain; + const char *errstr; + + rdomain = strtonum(s, 0, RT_TABLEID_MAX, &errstr); + if (errstr != NULL) + return -1; + return (int)rdomain; +} + int a2tun(const char *s, int *remote) { diff --git a/misc.h b/misc.h index 87b7f0ed..1e859e25 100644 --- a/misc.h +++ b/misc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.h,v 1.39 2009/10/28 16:38:18 reyk Exp $ */ +/* $OpenBSD: misc.h,v 1.40 2009/12/25 19:40:21 stevesk Exp $ */ /* * Author: Tatu Ylonen @@ -23,6 +23,7 @@ int set_nonblock(int); int unset_nonblock(int); void set_nodelay(int); int a2port(const char *); +int a2rdomain(const char *); int a2tun(const char *, int *); char *put_host_port(const char *, u_short); char *hpdelim(char **); diff --git a/readconf.c b/readconf.c index 6b2e3b21..2f1b0cd3 100644 --- a/readconf.c +++ b/readconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readconf.c,v 1.179 2009/10/28 16:38:18 reyk Exp $ */ +/* $OpenBSD: readconf.c,v 1.180 2009/12/25 19:40:21 stevesk Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -925,7 +925,7 @@ parse_int: if (!arg || *arg == '\0') fatal("%.200s line %d: Missing argument.", filename, linenum); - value = a2port(arg); + value = a2rdomain(arg); if (value == -1) fatal("%.200s line %d: Bad rdomain.", filename, linenum); diff --git a/servconf.c b/servconf.c index 729f23ba..8b8518aa 100644 --- a/servconf.c +++ b/servconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: servconf.c,v 1.197 2009/10/28 16:38:18 reyk Exp $ */ +/* $OpenBSD: servconf.c,v 1.198 2009/12/25 19:40:21 stevesk Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved @@ -1298,7 +1298,16 @@ process_server_config_line(ServerOptions *options, char *line, case sRDomain: intptr = &options->rdomain; - goto parse_int; + arg = strdelim(&cp); + if (!arg || *arg == '\0') + fatal("%s line %d: missing rdomain value.", + filename, linenum); + if ((value = a2rdomain(arg)) == -1) + fatal("%s line %d: invalid rdomain value.", + filename, linenum); + if (*intptr == -1) + *intptr = value; + break; case sDeprecated: logit("%s line %d: Deprecated option %s", diff --git a/ssh-keyscan.c b/ssh-keyscan.c index f30e8504..faeb9e13 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keyscan.c,v 1.79 2009/10/28 16:38:18 reyk Exp $ */ +/* $OpenBSD: ssh-keyscan.c,v 1.80 2009/12/25 19:40:21 stevesk Exp $ */ /* * Copyright 1995, 1996 by David Mazieres . * @@ -807,9 +807,11 @@ main(int argc, char **argv) IPv4or6 = AF_INET6; break; case 'V': - scan_rdomain = a2port(optarg); - if (scan_rdomain < 0) - scan_rdomain = -1; + scan_rdomain = a2rdomain(optarg); + if (scan_rdomain == -1) { + fprintf(stderr, "Bad rdomain '%s'\n", optarg); + exit(1); + } break; case '?': default: