1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Fix format string errors and some missing error case initialization.

* common/logging.c (do_logv): Remove extra parentheses in comparison.

* dirmngr/dns-stuff.c (resolve_addr_libdns): Init RES so that
dns_res_close is given a defined value in the error case.

* dirmngr/http.c (cookie_read, cookie_write) [HTTP_USE_NTBTLS]: Fix
format string char.

* dirmngr/ks-engine-hkp.c (ks_hkp_help): Remove duplicate "const".
* dirmngr/ks-engine-http.c (ks_http_help): Ditto.
* dirmngr/ks-engine-kdns.c (ks_kdns_help): Ditto.
* dirmngr/ks-engine-ldap.c (ks_ldap_help): Ditto.

* scd/app-p15.c (send_keypairinfo, do_getattr): Fix format string
char.
* tools/gpgconf-comp.c (gpg_agent_runtime_change): Init PID for the
error case.
(scdaemon_runtime_change): Ditto.
(dirmngr_runtime_change): Ditto.

* tools/gpgconf.c (query_swdb): Init VALUE_SIZE_UL.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2017-01-23 16:32:44 +01:00
parent 3ca3da8fc4
commit af5979a42b
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
10 changed files with 14 additions and 14 deletions

View File

@ -798,7 +798,7 @@ do_logv (int level, int ignore_arg_ptr, const char *extrastring,
es_fputs_unlocked ("\\\\", logstream); es_fputs_unlocked ("\\\\", logstream);
else if (c == '\r') else if (c == '\r')
es_fputs_unlocked ("\\r", logstream); es_fputs_unlocked ("\\r", logstream);
else if ((c == '\n')) else if (c == '\n')
{ {
es_fputs_unlocked ("\\n\n", logstream); es_fputs_unlocked ("\\n\n", logstream);
if (*extrastring) if (*extrastring)

View File

@ -947,7 +947,7 @@ resolve_addr_libdns (const struct sockaddr *addr, int addrlen,
{ {
gpg_error_t err; gpg_error_t err;
char host[DNS_D_MAXNAME + 1]; char host[DNS_D_MAXNAME + 1];
struct dns_resolver *res; struct dns_resolver *res = NULL;
struct dns_packet *ans = NULL; struct dns_packet *ans = NULL;
struct dns_ptr ptr; struct dns_ptr ptr;
int derr; int derr;

View File

@ -2707,7 +2707,7 @@ cookie_read (void *cookie, void *buffer, size_t size)
ntbtls_get_stream (c->session->tls_session, &in, &out); ntbtls_get_stream (c->session->tls_session, &in, &out);
nread = es_fread (buffer, 1, size, in); nread = es_fread (buffer, 1, size, in);
if (opt_debug) if (opt_debug)
log_debug ("TLS network read: %d/%u\n", nread, size); log_debug ("TLS network read: %d/%zu\n", nread, size);
} }
else else
#elif HTTP_USE_GNUTLS #elif HTTP_USE_GNUTLS
@ -2800,7 +2800,7 @@ cookie_write (void *cookie, const void *buffer_arg, size_t size)
else else
nwritten = es_fwrite (buffer, 1, size, out); nwritten = es_fwrite (buffer, 1, size, out);
if (opt_debug) if (opt_debug)
log_debug ("TLS network write: %d/%u\n", nwritten, size); log_debug ("TLS network write: %d/%zu\n", nwritten, size);
} }
else else
#elif HTTP_USE_GNUTLS #elif HTTP_USE_GNUTLS

View File

@ -851,7 +851,7 @@ ks_hkp_print_hosttable (ctrl_t ctrl)
gpg_error_t gpg_error_t
ks_hkp_help (ctrl_t ctrl, parsed_uri_t uri) ks_hkp_help (ctrl_t ctrl, parsed_uri_t uri)
{ {
const char const data[] = const char data[] =
"Handler for HKP URLs:\n" "Handler for HKP URLs:\n"
" hkp://\n" " hkp://\n"
#if HTTP_USE_GNUTLS || HTTP_USE_NTBTLS #if HTTP_USE_GNUTLS || HTTP_USE_NTBTLS

View File

@ -35,7 +35,7 @@
gpg_error_t gpg_error_t
ks_http_help (ctrl_t ctrl, parsed_uri_t uri) ks_http_help (ctrl_t ctrl, parsed_uri_t uri)
{ {
const char const data[] = const char data[] =
"Handler for HTTP URLs:\n" "Handler for HTTP URLs:\n"
" http://\n" " http://\n"
#if HTTP_USE_GNUTLS || HTTP_USE_NTBTLS #if HTTP_USE_GNUTLS || HTTP_USE_NTBTLS

View File

@ -33,7 +33,7 @@
gpg_error_t gpg_error_t
ks_kdns_help (ctrl_t ctrl, parsed_uri_t uri) ks_kdns_help (ctrl_t ctrl, parsed_uri_t uri)
{ {
const char const data[] = const char data[] =
"This keyserver engine accepts URLs of the form:\n" "This keyserver engine accepts URLs of the form:\n"
" kdns://[NAMESERVER]/[ROOT][?at=STRING]\n" " kdns://[NAMESERVER]/[ROOT][?at=STRING]\n"
"with\n" "with\n"

View File

@ -289,7 +289,7 @@ epoch2ldaptime (time_t stamp)
gpg_error_t gpg_error_t
ks_ldap_help (ctrl_t ctrl, parsed_uri_t uri) ks_ldap_help (ctrl_t ctrl, parsed_uri_t uri)
{ {
const char const data[] = const char data[] =
"Handler for LDAP URLs:\n" "Handler for LDAP URLs:\n"
" ldap://host:port/[BASEDN]???[bindname=BINDNAME,password=PASSWORD]\n" " ldap://host:port/[BASEDN]???[bindname=BINDNAME,password=PASSWORD]\n"
"\n" "\n"

View File

@ -2463,7 +2463,7 @@ send_keypairinfo (app_t app, ctrl_t ctrl, prkdf_object_t keyinfo)
p = stpcpy (buf, "P15"); p = stpcpy (buf, "P15");
if (app->app_local->home_df) if (app->app_local->home_df)
{ {
snprintf (p, 6, "-%04hX", snprintf (p, 6, "-%04X",
(unsigned int)(app->app_local->home_df & 0xffff)); (unsigned int)(app->app_local->home_df & 0xffff));
p += 5; p += 5;
} }
@ -2689,7 +2689,7 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
p = stpcpy (buf, "P15"); p = stpcpy (buf, "P15");
if (app->app_local->home_df) if (app->app_local->home_df)
{ {
snprintf (p, 6, "-%04hX", snprintf (p, 6, "-%04X",
(unsigned int)(app->app_local->home_df & 0xffff)); (unsigned int)(app->app_local->home_df & 0xffff));
p += 5; p += 5;
} }

View File

@ -1138,7 +1138,7 @@ gpg_agent_runtime_change (int killflag)
gpg_error_t err = 0; gpg_error_t err = 0;
const char *pgmname; const char *pgmname;
const char *argv[5]; const char *argv[5];
pid_t pid; pid_t pid = (pid_t)(-1);
char *abs_homedir = NULL; char *abs_homedir = NULL;
int i = 0; int i = 0;
@ -1174,7 +1174,7 @@ scdaemon_runtime_change (int killflag)
gpg_error_t err = 0; gpg_error_t err = 0;
const char *pgmname; const char *pgmname;
const char *argv[9]; const char *argv[9];
pid_t pid; pid_t pid = (pid_t)(-1);
char *abs_homedir = NULL; char *abs_homedir = NULL;
int i = 0; int i = 0;
@ -1221,7 +1221,7 @@ dirmngr_runtime_change (int killflag)
gpg_error_t err = 0; gpg_error_t err = 0;
const char *pgmname; const char *pgmname;
const char *argv[6]; const char *argv[6];
pid_t pid; pid_t pid = (pid_t)(-1);
char *abs_homedir = NULL; char *abs_homedir = NULL;
pgmname = gnupg_module_name (GNUPG_MODULE_NAME_CONNECT_AGENT); pgmname = gnupg_module_name (GNUPG_MODULE_NAME_CONNECT_AGENT);

View File

@ -280,7 +280,7 @@ query_swdb (estream_t out, const char *name, const char *current_version)
gnupg_isotime_t value_date = {0}; gnupg_isotime_t value_date = {0};
char *value_size = NULL; char *value_size = NULL;
char *value_sha2 = NULL; char *value_sha2 = NULL;
unsigned long value_size_ul; unsigned long value_size_ul = 0;
int status, i; int status, i;