зеркало из https://github.com/github/putty.git
Fix format string mistakes revealed by new checking.
An assortment of errors: int vs size_t confusion (probably undetected
since the big switchover in commit 0cda34c6f
), some outright spurious
parameters after the format string (copy-paste errors), a particularly
silly one in pscp.c (a comma between two halves of what should have
been a single string literal), and a _missing_ format string in ssh.c
(but luckily in a context where the only text that would be wrongly
treated as a format string was error messages generated elsewhere in
PuTTY).
This commit is contained in:
Родитель
cbfba7a0e9
Коммит
247866a9d3
|
@ -344,7 +344,7 @@ void log_packet(LogContext *ctx, int direction, int type,
|
|||
/* If we're about to stop omitting, it's time to say how
|
||||
* much we omitted. */
|
||||
if ((blktype != PKTLOG_OMIT) && omitted) {
|
||||
logprintf(ctx, " (%d byte%s omitted)\r\n",
|
||||
logprintf(ctx, " (%zu byte%s omitted)\r\n",
|
||||
omitted, (omitted==1?"":"s"));
|
||||
omitted = 0;
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ void log_packet(LogContext *ctx, int direction, int type,
|
|||
|
||||
/* Tidy up */
|
||||
if (omitted)
|
||||
logprintf(ctx, " (%d byte%s omitted)\r\n",
|
||||
logprintf(ctx, " (%zu byte%s omitted)\r\n",
|
||||
omitted, (omitted==1?"":"s"));
|
||||
logflush(ctx);
|
||||
}
|
||||
|
|
2
misc.c
2
misc.c
|
@ -223,7 +223,7 @@ char *buildinfo(const char *newline)
|
|||
#else
|
||||
strbuf_catf(buf, ", emulating ");
|
||||
#endif
|
||||
strbuf_catf(buf, "Visual Studio", newline);
|
||||
strbuf_catf(buf, "Visual Studio");
|
||||
|
||||
#if 0
|
||||
/*
|
||||
|
|
2
pscp.c
2
pscp.c
|
@ -1789,7 +1789,7 @@ static void sink(const char *targ, const char *src)
|
|||
with_stripctrl(santarg, act.name) {
|
||||
tell_user(stderr, "warning: remote host sent a"
|
||||
" compound pathname '%s'", sanname);
|
||||
tell_user(stderr, " renaming local",
|
||||
tell_user(stderr, " renaming local"
|
||||
" file to '%s'", santarg);
|
||||
}
|
||||
}
|
||||
|
|
2
ssh.c
2
ssh.c
|
@ -562,7 +562,7 @@ void ssh_deferred_abort_callback(void *vctx)
|
|||
Ssh *ssh = (Ssh *)vctx;
|
||||
char *msg = ssh->deferred_abort_message;
|
||||
ssh->deferred_abort_message = NULL;
|
||||
ssh_sw_abort(ssh, msg);
|
||||
ssh_sw_abort(ssh, "%s", msg);
|
||||
sfree(msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -750,7 +750,8 @@ static bool ssh2_connection_filter_queue(struct ssh2_connection_state *s)
|
|||
"Received %s for channel %d with no outstanding "
|
||||
"channel request",
|
||||
ssh2_pkt_type(s->ppl.bpp->pls->kctx,
|
||||
s->ppl.bpp->pls->actx, pktin->type));
|
||||
s->ppl.bpp->pls->actx, pktin->type),
|
||||
c->localid);
|
||||
return true;
|
||||
}
|
||||
ocr->handler(c, pktin, ocr->ctx);
|
||||
|
|
|
@ -42,7 +42,7 @@ static ssh2_mac *hmac_new(const ssh2_macalg *alg, ssh_cipher *cipher)
|
|||
ctx->digest = snewn(ctx->hashalg->hlen, uint8_t);
|
||||
|
||||
ctx->text_name = strbuf_new();
|
||||
strbuf_catf(ctx->text_name, "HMAC-%s",
|
||||
strbuf_catf(ctx->text_name, "HMAC-%s%s",
|
||||
ctx->hashalg->text_basename, extra->suffix);
|
||||
if (extra->annotation || ctx->hashalg->annotation) {
|
||||
strbuf_catf(ctx->text_name, " (");
|
||||
|
|
2
sshrsa.c
2
sshrsa.c
|
@ -296,7 +296,7 @@ char *rsa_ssh1_fingerprint(RSAKey *key)
|
|||
ssh_hash_final(hash, digest);
|
||||
|
||||
out = strbuf_new();
|
||||
strbuf_catf(out, "%d ", mp_get_nbits(key->modulus));
|
||||
strbuf_catf(out, "%zu ", mp_get_nbits(key->modulus));
|
||||
for (i = 0; i < 16; i++)
|
||||
strbuf_catf(out, "%s%02x", i ? ":" : "", digest[i]);
|
||||
if (key->comment)
|
||||
|
|
|
@ -1794,8 +1794,9 @@ static void share_receive(Plug *plug, int urgent, const char *data, size_t len)
|
|||
}
|
||||
if (cs->recvlen > 0 && cs->recvbuf[cs->recvlen-1] == '\015')
|
||||
cs->recvlen--; /* trim off \r before \n */
|
||||
ptrlen verstring = make_ptrlen(cs->recvbuf, cs->recvlen);
|
||||
log_downstream(cs, "Downstream version string: %.*s",
|
||||
cs->recvlen, cs->recvbuf);
|
||||
PTRLEN_PRINTF(verstring));
|
||||
cs->got_verstring = true;
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче