mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
Fix seg fault in s_time
Passing a negative value for the "-time" option to s_time results in a seg fault. This commit fixes it so that time has to be greater than 0. Reviewed-by: Andy Polyakov <appro@openssl.org>
This commit is contained in:
parent
668f6f08c6
commit
dfef52f6f2
@ -283,6 +283,10 @@ static int parseArgs(int argc, char **argv)
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
maxTime = atoi(*(++argv));
|
||||
if(maxTime <= 0) {
|
||||
BIO_printf(bio_err, "time must be > 0\n");
|
||||
badop = 1;
|
||||
}
|
||||
} else {
|
||||
BIO_printf(bio_err, "unknown option %s\n", *argv);
|
||||
badop = 1;
|
||||
@ -527,7 +531,8 @@ int MAIN(int argc, char **argv)
|
||||
nConn, totalTime, ((double)nConn / totalTime), bytes_read);
|
||||
printf
|
||||
("%d connections in %ld real seconds, %ld bytes read per connection\n",
|
||||
nConn, (long)time(NULL) - finishtime + maxTime, bytes_read / nConn);
|
||||
nConn, (long)time(NULL) - finishtime + maxTime,
|
||||
bytes_read / (nConn?nConn:1));
|
||||
|
||||
ret = 0;
|
||||
end:
|
||||
|
Loading…
Reference in New Issue
Block a user