Browse Source

silence valgrind

When compiling with clang (9-12) and then running the tests in
valgrind (I tested 3.13.0 and 3.15.0) the following error was created:

```
Conditional jump or move depends on uninitialised value(s)
   at 0x47761F: ecc_ssh_ecdsa_encode_name (ecc_ssh_ecdsa_encode_name.c:38)
   ...
Uninitialised value was created by a stack allocation
   at 0x477570: ecc_ssh_ecdsa_encode_name (ecc_ssh_ecdsa_encode_name.c:21)
```

This silences this error by initialising the stack-array on creation.

Signed-off-by: Steffen Jaeckel <[email protected]>
Steffen Jaeckel 3 years ago
parent
commit
31ab638fb6
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/pk/ecc/ecc_ssh_ecdsa_encode_name.c

+ 1 - 1
src/pk/ecc/ecc_ssh_ecdsa_encode_name.c

@@ -19,7 +19,7 @@
 */
 */
 int ecc_ssh_ecdsa_encode_name(char *buffer, unsigned long *buflen, const ecc_key *key)
 int ecc_ssh_ecdsa_encode_name(char *buffer, unsigned long *buflen, const ecc_key *key)
 {
 {
-   char oidstr[64];
+   char oidstr[64] = {0};
    unsigned long oidlen = sizeof(oidstr);
    unsigned long oidlen = sizeof(oidstr);
    int err, size = 0;
    int err, size = 0;