Page MenuHome GnuPG

warning: variable 'zlen' is uninitialized
Closed, InvalidPublic

Description

Hi Everyone,

This warning looks valid. zlen is indeed uninitialized and then used.

libtool: compile:  /usr/bin/clang -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -DNDEBUG -I/usr/local/include -I/usr/local/include -I/usr/local/include -g2 -O2 -fno-common -arch arm64 -fPIC -pthread -Wall -Wno-pointer-sign -Wpointer-arith -MT protocol-cli.lo -MD -MP -MF .deps/protocol-cli.Tpo -c protocol-cli.c  -fno-common -DPIC -o .libs/protocol-cli.o
protocol.c:701:33: warning: variable 'zlen' is uninitialized when used here
      [-Wuninitialized]
      *(p++) = (unsigned char) (zlen >> 8);
                                ^~~~
protocol.c:690:18: note: initialize the variable 'zlen' to silence this warning
      size_t zlen;
                 ^
                  = 0

Details

Version
0.20.0

Event Timeline

werner added a subscriber: werner.

Please look at the code:

err = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
if (err)
  {
    debug_ret (1, "ecdh_calc_secret", err);
    return err;
  }

*(p++) = (unsigned char) (zlen >> 8);