Browse Source

fwd-port win32 isprint fix

svn:r3410
Nick Mathewson 20 years ago
parent
commit
fbb7f869c5
2 changed files with 2 additions and 1 deletions
  1. 1 0
      src/common/compat.h
  2. 1 1
      src/or/directory.c

+ 1 - 0
src/common/compat.h

@@ -85,6 +85,7 @@ int tor_vsnprintf(char *str, size_t size, const char *format, va_list args);
 #define TOR_ISSPACE(c)   isspace((int)(unsigned char)(c))
 #define TOR_ISSPACE(c)   isspace((int)(unsigned char)(c))
 #define TOR_ISXDIGIT(c) isxdigit((int)(unsigned char)(c))
 #define TOR_ISXDIGIT(c) isxdigit((int)(unsigned char)(c))
 #define TOR_ISDIGIT(c)   isdigit((int)(unsigned char)(c))
 #define TOR_ISDIGIT(c)   isdigit((int)(unsigned char)(c))
+#define TOR_ISPRINT(c)   isprint((int)(unsigned char)(c))
 
 
 #define _SHORT_FILE_ (_tor_fix_source_file(__FILE__))
 #define _SHORT_FILE_ (_tor_fix_source_file(__FILE__))
 const char *_tor_fix_source_file(const char *fname);
 const char *_tor_fix_source_file(const char *fname);

+ 1 - 1
src/or/directory.c

@@ -566,7 +566,7 @@ body_is_plausible(const char *body, size_t len, int purpose)
         !strcmpstart(body,"running-routers"))
         !strcmpstart(body,"running-routers"))
     return 1;
     return 1;
     for (i=0;i<32;++i) {
     for (i=0;i<32;++i) {
-      if (!isprint(body[i]) && !isspace(body[i]))
+      if (!TOR_ISPRINT(body[i]) && !TOR_ISSPACE(body[i]))
         return 0;
         return 0;
     }
     }
     return 1;
     return 1;