Apparently Vista's printf-like functions don't support %n by default.
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Sat, 31 May 2008 17:22:29 +0000 (17:22 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
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>

git-svn-id: svn://svn.tartarus.org/sgt/putty@8030 cda61777-01e9-0310-a592-d414129be87e

ssh.c

diff --git a/ssh.c b/ssh.c
index eec0580..f22a2b6 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);
 }