mirror of
git://anongit.mindrot.org/openssh.git
synced 2025-02-27 19:31:11 +00:00
- dtucker@cvs.openbsd.org 2013/05/16 09:12:31
[readconf.c servconf.c] switch RekeyLimit traffic volume parsing to scan_scaled. ok djm@
This commit is contained in:
parent
dbee308253
commit
b7ee852144
@ -47,6 +47,9 @@
|
|||||||
[log.c scp.c sshd.c serverloop.c schnorr.c sftp.c]
|
[log.c scp.c sshd.c serverloop.c schnorr.c sftp.c]
|
||||||
Fix some "unused result" warnings found via clang and -portable.
|
Fix some "unused result" warnings found via clang and -portable.
|
||||||
ok markus@
|
ok markus@
|
||||||
|
- dtucker@cvs.openbsd.org 2013/05/16 09:12:31
|
||||||
|
[readconf.c servconf.c]
|
||||||
|
switch RekeyLimit traffic volume parsing to scan_scaled. ok djm@
|
||||||
|
|
||||||
20130510
|
20130510
|
||||||
- (dtucker) [configure.ac] Enable -Wsizeof-pointer-memaccess if the compiler
|
- (dtucker) [configure.ac] Enable -Wsizeof-pointer-memaccess if the compiler
|
||||||
|
35
readconf.c
35
readconf.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: readconf.c,v 1.199 2013/05/16 04:27:50 djm Exp $ */
|
/* $OpenBSD: readconf.c,v 1.200 2013/05/16 09:12:31 dtucker Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -30,6 +30,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <util.h>
|
||||||
|
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
@ -579,33 +580,11 @@ parse_yesnoask:
|
|||||||
if (strcmp(arg, "default") == 0) {
|
if (strcmp(arg, "default") == 0) {
|
||||||
val64 = 0;
|
val64 = 0;
|
||||||
} else {
|
} else {
|
||||||
if (arg[0] < '0' || arg[0] > '9')
|
if (scan_scaled(arg, &val64) == -1)
|
||||||
fatal("%.200s line %d: Bad number.", filename,
|
fatal("%.200s line %d: Bad number '%s': %s",
|
||||||
linenum);
|
filename, linenum, arg, strerror(errno));
|
||||||
orig = val64 = strtoll(arg, &endofnumber, 10);
|
/* check for too-large or too-small limits */
|
||||||
if (arg == endofnumber)
|
if (val64 > UINT_MAX)
|
||||||
fatal("%.200s line %d: Bad number.", filename,
|
|
||||||
linenum);
|
|
||||||
switch (toupper(*endofnumber)) {
|
|
||||||
case '\0':
|
|
||||||
scale = 1;
|
|
||||||
break;
|
|
||||||
case 'K':
|
|
||||||
scale = 1<<10;
|
|
||||||
break;
|
|
||||||
case 'M':
|
|
||||||
scale = 1<<20;
|
|
||||||
break;
|
|
||||||
case 'G':
|
|
||||||
scale = 1<<30;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fatal("%.200s line %d: Invalid RekeyLimit "
|
|
||||||
"suffix", filename, linenum);
|
|
||||||
}
|
|
||||||
val64 *= scale;
|
|
||||||
/* detect integer wrap and too-large limits */
|
|
||||||
if ((val64 / scale) != orig || val64 > UINT_MAX)
|
|
||||||
fatal("%.200s line %d: RekeyLimit too large",
|
fatal("%.200s line %d: RekeyLimit too large",
|
||||||
filename, linenum);
|
filename, linenum);
|
||||||
if (val64 != 0 && val64 < 16)
|
if (val64 != 0 && val64 < 16)
|
||||||
|
35
servconf.c
35
servconf.c
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
/* $OpenBSD: servconf.c,v 1.235 2013/05/16 04:09:14 dtucker Exp $ */
|
/* $OpenBSD: servconf.c,v 1.236 2013/05/16 09:12:31 dtucker Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
@ -30,6 +30,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <util.h>
|
||||||
|
|
||||||
#include "openbsd-compat/sys-queue.h"
|
#include "openbsd-compat/sys-queue.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
@ -1134,33 +1135,11 @@ process_server_config_line(ServerOptions *options, char *line,
|
|||||||
if (strcmp(arg, "default") == 0) {
|
if (strcmp(arg, "default") == 0) {
|
||||||
val64 = 0;
|
val64 = 0;
|
||||||
} else {
|
} else {
|
||||||
if (arg[0] < '0' || arg[0] > '9')
|
if (scan_scaled(arg, &val64) == -1)
|
||||||
fatal("%.200s line %d: Bad number.", filename,
|
fatal("%.200s line %d: Bad number '%s': %s",
|
||||||
linenum);
|
filename, linenum, arg, strerror(errno));
|
||||||
orig = val64 = strtoll(arg, &endofnumber, 10);
|
/* check for too-large or too-small limits */
|
||||||
if (arg == endofnumber)
|
if (val64 > UINT_MAX)
|
||||||
fatal("%.200s line %d: Bad number.", filename,
|
|
||||||
linenum);
|
|
||||||
switch (toupper(*endofnumber)) {
|
|
||||||
case '\0':
|
|
||||||
scale = 1;
|
|
||||||
break;
|
|
||||||
case 'K':
|
|
||||||
scale = 1<<10;
|
|
||||||
break;
|
|
||||||
case 'M':
|
|
||||||
scale = 1<<20;
|
|
||||||
break;
|
|
||||||
case 'G':
|
|
||||||
scale = 1<<30;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fatal("%.200s line %d: Invalid RekeyLimit "
|
|
||||||
"suffix", filename, linenum);
|
|
||||||
}
|
|
||||||
val64 *= scale;
|
|
||||||
/* detect integer wrap and too-large limits */
|
|
||||||
if ((val64 / scale) != orig || val64 > UINT_MAX)
|
|
||||||
fatal("%.200s line %d: RekeyLimit too large",
|
fatal("%.200s line %d: RekeyLimit too large",
|
||||||
filename, linenum);
|
filename, linenum);
|
||||||
if (val64 != 0 && val64 < 16)
|
if (val64 != 0 && val64 < 16)
|
||||||
|
Loading…
Reference in New Issue
Block a user