The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3113
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === If SSL is enabled, utils will include function `do_sha1_hash()` to generate a sha1 encrypted buffer. Last function argument of `EVP_DigestFinal_ex()` requires a `unsigned int` but the current parameter is an `integer` type. See error: utils.c:350:38: error: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Werror,-Wpointer-sign] EVP_DigestFinal_ex(mdctx, md_value, md_len); ^~~~~~ /usr/include/openssl/evp.h:549:49: note: passing argument to parameter 's' here unsigned int *s); Signed-off-by: Julio Faracco <jcfara...@gmail.com>
From 7c3d3976fa4036fe5c260ca3a68376360e98e260 Mon Sep 17 00:00:00 2001 From: Julio Faracco <jcfara...@gmail.com> Date: Sat, 3 Aug 2019 02:16:13 -0300 Subject: [PATCH] utils: Fix wrong integer of a function parameter. If SSL is enabled, utils will include function `do_sha1_hash()` to generate a sha1 encrypted buffer. Last function argument of `EVP_DigestFinal_ex()` requires a `unsigned int` but the current parameter is an `integer` type. See error: utils.c:350:38: error: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Werror,-Wpointer-sign] EVP_DigestFinal_ex(mdctx, md_value, md_len); ^~~~~~ /usr/include/openssl/evp.h:549:49: note: passing argument to parameter 's' here unsigned int *s); Signed-off-by: Julio Faracco <jcfara...@gmail.com> --- src/lxc/lxccontainer.c | 3 ++- src/lxc/utils.c | 4 ++-- src/lxc/utils.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 52c38fd330..09d427a491 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -1660,7 +1660,8 @@ static bool prepend_lxc_header(char *path, const char *t, char *const argv[]) FILE *f; int ret = -1; #if HAVE_OPENSSL - int i, md_len = 0; + int i; + unsigned int md_len = 0; unsigned char md_value[EVP_MAX_MD_SIZE]; char *tpath; #endif diff --git a/src/lxc/utils.c b/src/lxc/utils.c index bf4a9c2cbd..9ddbabfc85 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -333,7 +333,7 @@ int lxc_wait_for_pid_status(pid_t pid) #ifdef HAVE_OPENSSL #include <openssl/evp.h> -static int do_sha1_hash(const char *buf, int buflen, unsigned char *md_value, int *md_len) +static int do_sha1_hash(const char *buf, int buflen, unsigned char *md_value, unsigned int *md_len) { EVP_MD_CTX *mdctx; const EVP_MD *md; @@ -353,7 +353,7 @@ static int do_sha1_hash(const char *buf, int buflen, unsigned char *md_value, in return 0; } -int sha1sum_file(char *fnam, unsigned char *digest, int *md_len) +int sha1sum_file(char *fnam, unsigned char *digest, unsigned int *md_len) { char *buf; int ret; diff --git a/src/lxc/utils.h b/src/lxc/utils.h index dd6404f0b3..c1667e8c4c 100644 --- a/src/lxc/utils.h +++ b/src/lxc/utils.h @@ -99,7 +99,7 @@ extern int wait_for_pid(pid_t pid); extern int lxc_wait_for_pid_status(pid_t pid); #if HAVE_OPENSSL -extern int sha1sum_file(char *fnam, unsigned char *md_value, int *md_len); +extern int sha1sum_file(char *fnam, unsigned char *md_value, unsigned int *md_len); #endif /* initialize rand with urandom */
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel