]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Apparently Vista's printf-like functions don't support %n by default.
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Sat, 31 May 2008 17:22:29 +0000 (17:22 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Sat, 31 May 2008 17:22:29 +0000 (17:22 +0000)
We could explicitly re-enable %n, but we only use it in one place, so take
the path of least resistance and remove that single instance. This stops
dupvprintf() getting stuck in a loop (a behaviour that's caused by a workaround
for a broken libc).

<http://msdn.microsoft.com/en-us/library/ms175782(VS.80).aspx>

[originally from svn r8030]

ssh.c

diff --git a/ssh.c b/ssh.c
index eec05808948c8d402ad43e1ef846d26bc6fe5894..f22a2b61ec2ad59f696193c38b0d78276c333968 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -8569,7 +8569,7 @@ static void ssh2_msg_disconnect(Ssh ssh, struct Packet *pktin)
 {
     /* log reason code in disconnect message */
     char *buf, *msg;
-    int nowlen, reason, msglen;
+    int reason, msglen;
 
     reason = ssh_pkt_getuint32(pktin);
     ssh_pkt_getstring(pktin, &msg, &msglen);
@@ -8583,14 +8583,14 @@ static void ssh2_msg_disconnect(Ssh ssh, struct Packet *pktin)
     }
     logevent(buf);
     sfree(buf);
-    buf = dupprintf("Disconnection message text: %n%.*s",
-                   &nowlen, msglen, msg);
+    buf = dupprintf("Disconnection message text: %.*s",
+                   msglen, msg);
     logevent(buf);
-    bombout(("Server sent disconnect message\ntype %d (%s):\n\"%s\"",
+    bombout(("Server sent disconnect message\ntype %d (%s):\n\"%.*s\"",
             reason,
             (reason > 0 && reason < lenof(ssh2_disconnect_reasons)) ?
             ssh2_disconnect_reasons[reason] : "unknown",
-            buf+nowlen));
+            msglen, msg));
     sfree(buf);
 }