Bug Summary

File:out/../deps/openssl/openssl/apps/lib/app_params.c
Warning:line 69, column 9
Value stored to 'bufsz' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name app_params.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/home/maurizio/node-v18.6.0/out -resource-dir /usr/local/lib/clang/16.0.0 -D V8_DEPRECATION_WARNINGS -D V8_IMMINENT_DEPRECATION_WARNINGS -D _GLIBCXX_USE_CXX11_ABI=1 -D NODE_OPENSSL_CONF_NAME=nodejs_conf -D NODE_OPENSSL_HAS_QUIC -D __STDC_FORMAT_MACROS -D OPENSSL_NO_PINSHARED -D OPENSSL_THREADS -D OPENSSL_API_COMPAT=0x10100001L -D NDEBUG -D OPENSSL_USE_NODELETE -D L_ENDIAN -D OPENSSL_BUILDING_OPENSSL -D AES_ASM -D BSAES_ASM -D CMLL_ASM -D ECP_NISTZ256_ASM -D GHASH_ASM -D KECCAK1600_ASM -D MD5_ASM -D OPENSSL_BN_ASM_GF2m -D OPENSSL_BN_ASM_MONT -D OPENSSL_BN_ASM_MONT5 -D OPENSSL_CPUID_OBJ -D OPENSSL_IA32_SSE2 -D PADLOCK_ASM -D POLY1305_ASM -D SHA1_ASM -D SHA256_ASM -D SHA512_ASM -D VPAES_ASM -D WHIRLPOOL_ASM -D X25519_ASM -D OPENSSL_PIC -D OPENSSLDIR="/etc/ssl" -D ENGINESDIR="/dev/null" -D TERMIOS -I ../deps/openssl/openssl/apps/include -I ../deps/openssl/openssl -I ../deps/openssl/openssl/include -I ../deps/openssl/openssl/crypto -I ../deps/openssl/openssl/crypto/include -I ../deps/openssl/openssl/crypto/modes -I ../deps/openssl/openssl/crypto/ec/curve448 -I ../deps/openssl/openssl/crypto/ec/curve448/arch_32 -I ../deps/openssl/openssl/providers/common/include -I ../deps/openssl/openssl/providers/implementations/include -I ../deps/openssl/config -I ../deps/openssl/config/archs/linux-x86_64/asm/include -I ../deps/openssl/openssl/include -I ../deps/openssl/openssl/crypto/include -I ../deps/openssl/config/archs/linux-x86_64/asm -internal-isystem /usr/local/lib/clang/16.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-unused-parameter -Wno-missing-field-initializers -Wno-old-style-declaration -fdebug-compilation-dir=/home/maurizio/node-v18.6.0/out -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2022-08-22-142216-507842-1 -x c ../deps/openssl/openssl/apps/lib/app_params.c
1/*
2 * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#include "apps.h"
11#include "app_params.h"
12
13static int describe_param_type(char *buf, size_t bufsz, const OSSL_PARAM *param)
14{
15 const char *type_mod = "";
16 const char *type = NULL((void*)0);
17 int show_type_number = 0;
18 int printed_len;
19
20 switch (param->data_type) {
21 case OSSL_PARAM_UNSIGNED_INTEGER2:
22 type_mod = "unsigned ";
23 /* FALLTHRU */
24 case OSSL_PARAM_INTEGER1:
25 type = "integer";
26 break;
27 case OSSL_PARAM_UTF8_PTR6:
28 type_mod = "pointer to a ";
29 /* FALLTHRU */
30 case OSSL_PARAM_UTF8_STRING4:
31 type = "UTF8 encoded string";
32 break;
33 case OSSL_PARAM_OCTET_PTR7:
34 type_mod = "pointer to an ";
35 /* FALLTHRU */
36 case OSSL_PARAM_OCTET_STRING5:
37 type = "octet string";
38 break;
39 default:
40 type = "unknown type";
41 show_type_number = 1;
42 break;
43 }
44
45 printed_len = BIO_snprintf(buf, bufsz, "%s: ", param->key);
46 if (printed_len > 0) {
47 buf += printed_len;
48 bufsz -= printed_len;
49 }
50 printed_len = BIO_snprintf(buf, bufsz, "%s%s", type_mod, type);
51 if (printed_len > 0) {
52 buf += printed_len;
53 bufsz -= printed_len;
54 }
55 if (show_type_number) {
56 printed_len = BIO_snprintf(buf, bufsz, " [%d]", param->data_type);
57 if (printed_len > 0) {
58 buf += printed_len;
59 bufsz -= printed_len;
60 }
61 }
62 if (param->data_size == 0)
63 printed_len = BIO_snprintf(buf, bufsz, " (arbitrary size)");
64 else
65 printed_len = BIO_snprintf(buf, bufsz, " (max %zu bytes large)",
66 param->data_size);
67 if (printed_len > 0) {
68 buf += printed_len;
69 bufsz -= printed_len;
Value stored to 'bufsz' is never read
70 }
71 *buf = '\0';
72 return 1;
73}
74
75int print_param_types(const char *thing, const OSSL_PARAM *pdefs, int indent)
76{
77 if (pdefs == NULL((void*)0)) {
78 return 1;
79 } else if (pdefs->key == NULL((void*)0)) {
80 /*
81 * An empty list? This shouldn't happen, but let's just make sure to
82 * say something if there's a badly written provider...
83 */
84 BIO_printf(bio_out, "%*sEmpty list of %s (!!!)\n", indent, "", thing);
85 } else {
86 BIO_printf(bio_out, "%*s%s:\n", indent, "", thing);
87 for (; pdefs->key != NULL((void*)0); pdefs++) {
88 char buf[200]; /* This should be ample space */
89
90 describe_param_type(buf, sizeof(buf), pdefs);
91 BIO_printf(bio_out, "%*s %s\n", indent, "", buf);
92 }
93 }
94 return 1;
95}
96
97void print_param_value(const OSSL_PARAM *p, int indent)
98{
99 int64_t i;
100 uint64_t u;
101
102 printf("%*s%s: ", indent, "", p->key);
103 switch (p->data_type) {
104 case OSSL_PARAM_UNSIGNED_INTEGER2:
105 if (OSSL_PARAM_get_uint64(p, &u))
106 BIO_printf(bio_out, "%llu\n", (unsigned long long int)u);
107 else
108 BIO_printf(bio_out, "error getting value\n");
109 break;
110 case OSSL_PARAM_INTEGER1:
111 if (OSSL_PARAM_get_int64(p, &i))
112 BIO_printf(bio_out, "%lld\n", (long long int)i);
113 else
114 BIO_printf(bio_out, "error getting value\n");
115 break;
116 case OSSL_PARAM_UTF8_PTR6:
117 BIO_printf(bio_out, "'%s'\n", *(char **)(p->data));
118 break;
119 case OSSL_PARAM_UTF8_STRING4:
120 BIO_printf(bio_out, "'%s'\n", (char *)p->data);
121 break;
122 case OSSL_PARAM_OCTET_PTR7:
123 case OSSL_PARAM_OCTET_STRING5:
124 BIO_printf(bio_out, "<%zu bytes>\n", p->data_size);
125 break;
126 default:
127 BIO_printf(bio_out, "unknown type (%u) of %zu bytes\n",
128 p->data_type, p->data_size);
129 break;
130 }
131}
132