]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge remote-tracking branch 'public/bug7816_023'
authorNick Mathewson <nickm@torproject.org>
Thu, 7 Feb 2013 20:20:50 +0000 (15:20 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 7 Feb 2013 20:20:50 +0000 (15:20 -0500)
Conflicts:
src/common/util.c

1  2 
src/common/log.c
src/common/util.c
src/or/connection.c
src/or/control.c
src/or/geoip.c

Simple merge
index 7d72a896f983888c17ccf9c0cf9ed404de9381af,29aa83e5d63409d7eb2b8c3110c504790094764d..93e2ba8e141d35bfd3c6fada8817b0783985c259
@@@ -2358,24 -2305,10 +2358,26 @@@ read_file_to_str(const char *filename, 
      return NULL;
    }
  
-   if ((uint64_t)(statbuf.st_size)+1 >= SIZE_T_CEILING)
 +#ifndef _WIN32
 +/** When we detect that we're reading from a FIFO, don't read more than
 + * this many bytes.  It's insane overkill for most uses. */
 +#define FIFO_READ_MAX (1024*1024)
 +  if (S_ISFIFO(statbuf.st_mode)) {
 +    size_t sz = 0;
 +    string = read_file_to_str_until_eof(fd, FIFO_READ_MAX, &sz);
 +    if (string && stat_out) {
 +      statbuf.st_size = sz;
 +      memcpy(stat_out, &statbuf, sizeof(struct stat));
 +    }
 +    close(fd);
 +    return string;
 +  }
 +#endif
 +
+   if ((uint64_t)(statbuf.st_size)+1 >= SIZE_T_CEILING) {
+     close(fd);
      return NULL;
+   }
  
    string = tor_malloc((size_t)(statbuf.st_size+1));
  
Simple merge
Simple merge
diff --cc src/or/geoip.c
Simple merge