[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Backport escape_for_log() fixes.



Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv16232/src/common

Modified Files:
      Tag: tor-0_1_1-patches
	util.c 
Log Message:
Backport escape_for_log() fixes.

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.c,v
retrieving revision 1.254.2.3
retrieving revision 1.254.2.4
diff -u -p -d -r1.254.2.3 -r1.254.2.4
--- util.c	26 May 2006 13:52:11 -0000	1.254.2.3
+++ util.c	9 Jun 2006 17:07:42 -0000	1.254.2.4
@@ -609,7 +609,7 @@ esc_for_log(const char *s)
         len += 2;
         break;
       default:
-        if (TOR_ISPRINT(*cp))
+        if (TOR_ISPRINT(*cp) && ((uint8_t)*cp)<127)
           ++len;
         else
           len += 4;
@@ -640,10 +640,10 @@ esc_for_log(const char *s)
         *outp++ = 'r';
         break;
       default:
-        if (TOR_ISPRINT(*cp)) {
+        if (TOR_ISPRINT(*cp) && ((uint8_t)*cp)<127) {
           *outp++ = *cp;
         } else {
-          tor_snprintf(outp, 5, "\\%03o", (uint8_t) *cp);
+          tor_snprintf(outp, 5, "\\%03o", (int)(uint8_t) *cp);
           outp += 4;
         }
         break;