summaryrefslogtreecommitdiffstats
path: root/auth_mellon_util.c
diff options
context:
space:
mode:
authorolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2009-06-14 20:08:10 +0000
committerolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2009-06-14 20:08:10 +0000
commitddbb4d5f7f6aa6f4edff29e2c8716358dd91a08f (patch)
tree8da65c58b145a3525ad56b0ff81e8126da465f83 /auth_mellon_util.c
parenta0dd3b07dcfd46dd80d9e400ee61ede4c6d16984 (diff)
downloadmod_auth_mellon-ddbb4d5f7f6aa6f4edff29e2c8716358dd91a08f.tar.gz
mod_auth_mellon-ddbb4d5f7f6aa6f4edff29e2c8716358dd91a08f.tar.xz
mod_auth_mellon-ddbb4d5f7f6aa6f4edff29e2c8716358dd91a08f.zip
Update am_getfile to use apr_file_read_full.
This chages am_getfile to use apr_file_read_full instead of apr_file_read to avoid a potential problem if a signal is received while reading the file data. A signal could cause the apr_file_read to return less than the requested number of bytes. git-svn-id: https://modmellon.googlecode.com/svn/trunk@56 a716ebb1-153a-0410-b759-cfb97c6a1b53
Diffstat (limited to 'auth_mellon_util.c')
-rw-r--r--auth_mellon_util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/auth_mellon_util.c b/auth_mellon_util.c
index 6b19fd9..11e1989 100644
--- a/auth_mellon_util.c
+++ b/auth_mellon_util.c
@@ -558,12 +558,13 @@ char *am_getfile(apr_pool_t *conf, server_rec *s, const char *file)
nbytes = finfo.size;
data = (char *)apr_palloc(conf, nbytes + 1);
- if ((rv = apr_file_read(fd, (void *)data, &nbytes)) != 0) {
+ rv = apr_file_read_full(fd, data, nbytes, NULL);
+ if (rv != 0) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
- "apr_file_read: Error reading \"%s\" [%d] \"%s\"",
+ "apr_file_read_full: Error reading \"%s\" [%d] \"%s\"",
file, rv, apr_strerror(rv, buffer, sizeof(buffer)));
}
- data[finfo.size] = '\0';
+ data[nbytes] = '\0';
(void)apr_file_close(fd);