diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-02-22 07:18:46 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-02-22 07:18:46 +0000 |
commit | e8da6b26b62475114937077e88905be921937554 (patch) | |
tree | fd0222b21341177e7ab11462dbcd43326cc43a08 /src | |
parent | d37f4dd8a916f8b910e17ff7915783271fe5ab26 (diff) | |
download | tor-e8da6b26b62475114937077e88905be921937554.tar.gz tor-e8da6b26b62475114937077e88905be921937554.zip |
Note a non-bug in read_file_to_str as used. If we start to rely on it behaving differently, we need to change how it behaves. [Noticed by Chris Palmer]
svn:r3655
Diffstat (limited to 'src')
-rw-r--r-- | src/common/util.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/util.c b/src/common/util.c index 2d7f6903f7..4b17454e80 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -880,8 +880,15 @@ int write_bytes_to_file(const char *fname, const char *str, size_t len, return -1; } -/** Read the contents of <b>filename</b> into a newly allocated string; return the - * string on success or NULL on failure. +/** Read the contents of <b>filename</b> into a newly allocated + * string; return the string on success or NULL on failure. + */ +/* + * This function <em>may</em> return an erroneous result if the file + * is modified while it is running, but must not crash or overflow. + * Right now, the error case occurs when the file length grows between + * the call to stat and the call to read_all: the resulting string will + * be truncated. */ char *read_file_to_str(const char *filename, int bin) { int fd; /* router file */ |