]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps: fix warning about size_t / int conversion
authorArmin Fuerst <armin@fuerst.priv.at>
Sat, 6 Mar 2021 11:19:18 +0000 (12:19 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 9 Apr 2021 14:20:47 +0000 (16:20 +0200)
Windows builds show the following warning:
(..\apps\ca.c(2643): warning C4267: 'function': conversion
from 'size_t' to 'int', possible loss of data)

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14453)

apps/include/apps.h
apps/lib/apps.c
test/testutil/apps_mem.c

index a2826e6066451a0031de12dd4bf28eb19e117719..96b37ef95cb190830e4a4a1f32f7d1b86fbea45c 100644 (file)
@@ -212,7 +212,7 @@ typedef struct ca_db_st {
 } CA_DB;
 
 void app_bail_out(char *fmt, ...);
-void* app_malloc(int sz, const char *what);
+void *app_malloc(size_t sz, const char *what);
 BIGNUM *load_serial(const char *serialfile, int create, ASN1_INTEGER **retai);
 int save_serial(const char *serialfile, const char *suffix, const BIGNUM *serial,
                 ASN1_INTEGER **retai);
index 69a98ecf37caf9c62bfc75c69012260e7b188e4d..df4edfb837d2392d1c7485cd23782dd47b288d10 100644 (file)
@@ -628,12 +628,12 @@ void app_bail_out(char *fmt, ...)
     exit(1);
 }
 
-void* app_malloc(int sz, const char *what)
+void *app_malloc(size_t sz, const char *what)
 {
     void *vp = OPENSSL_malloc(sz);
 
     if (vp == NULL)
-        app_bail_out("%s: Could not allocate %d bytes for %s\n",
+        app_bail_out("%s: Could not allocate %zu bytes for %s\n",
                      opt_getprog(), sz, what);
     return vp;
 }
index fa60bc684827e6a08ea911199bb896d058b7d99e..5c74a303858e979ce9dd66be6beb18387790ab81 100644 (file)
@@ -11,7 +11,7 @@
 
 /* shim that avoids sucking in too much from apps/apps.c */
 
-void* app_malloc(int sz, const char *what)
+void *app_malloc(size_t sz, const char *what)
 {
     void *vp = OPENSSL_malloc(sz);