]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps: fix coverity 966560: division by zero
authorPauli <ppzgs1@gmail.com>
Wed, 17 Mar 2021 02:23:52 +0000 (12:23 +1000)
committerPauli <ppzgs1@gmail.com>
Thu, 18 Mar 2021 11:25:10 +0000 (21:25 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14586)

(cherry picked from commit 7e7e034a10842dad3866c9447481b8527024bf44)

apps/s_time.c

index 628e65b26e19c080f28e6b066a044ce1dbcc6001..eabf3c1a7979a3c2a47265e67a74303cbbcf7762 100644 (file)
@@ -263,7 +263,8 @@ int s_time_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,
+         nConn > 0 ? bytes_read / nConn : 0l);
 
     /*
      * Now loop and time connections using the same session id over and over