misc/172569: Fix div-by-zero in openssl
Erik Cederstrand
erik at cederstrand.dk
Wed Oct 10 11:20:01 UTC 2012
>Number: 172569
>Category: misc
>Synopsis: Fix div-by-zero in openssl
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Oct 10 11:20:01 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Erik Cederstrand
>Release: CURRENT
>Organization:
>Environment:
>Description:
Fix an (extremely unlikely) divide-by-zero in openssl, found by Clang Analyzer: http://scan.freebsd.your.org/freebsd-head/LATEST/secure/report-jo4Joj.html#EndPath
This can only happen if the process is stalled for more than SECONDS seconds (currently 30) between lines 397 and 401.
Fix an identical case while there.
>How-To-Repeat:
>Fix:
See patch
Patch attached with submission follows:
Index: head/crypto/openssl/apps/s_time.c
===================================================================
--- head/crypto/openssl/apps/s_time.c (revision 241370)
+++ head/crypto/openssl/apps/s_time.c (working copy)
@@ -449,6 +449,10 @@
}
totalTime += tm_Time_F(STOP); /* Add the time for this iteration */
+ if (nConn == 0) {
+ fprintf( stderr, "Unable to get any connections\n" );
+ goto end;
+ }
i=(int)((long)time(NULL)-finishtime+maxTime);
printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", 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);
@@ -540,6 +544,10 @@
totalTime += tm_Time_F(STOP); /* Add the time for this iteration*/
+ if (nConn == 0) {
+ fprintf( stderr, "Unable to get any connections\n" );
+ goto end;
+ }
printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", 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);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list