summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2006-03-23 19:37:39 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2006-03-23 19:37:39 +0000
commit9fd65346409401d52bab7dc22852d613d140b345 (patch)
tree4f7c0d71016c836b4c7fcb65db1434f1a53b39f7 /file_io
parentd58a1dd26e25f99827060031e6f1e99895797b06 (diff)
downloadlibapr-9fd65346409401d52bab7dc22852d613d140b345.tar.gz
The original value before seek() certainly could be at the upper bounds
of 2^32-1. Protect against this by trusting the error result. Backports: 388241 git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x@388243 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r--file_io/win32/seek.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/file_io/win32/seek.c b/file_io/win32/seek.c
index f3ac7cf9e..41bc28d4d 100644
--- a/file_io/win32/seek.c
+++ b/file_io/win32/seek.c
@@ -43,10 +43,16 @@ static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos )
DWORD offhi = (DWORD)(pos >> 32);
rc = SetFilePointer(thefile->filehand, offlo, &offhi, FILE_BEGIN);
- if (rc == 0xFFFFFFFF)
+ if (rc == INVALID_SET_FILE_POINTER)
+ /* A legal value, perhaps? MSDN implies prior SetLastError isn't
+ * needed, googling for SetLastError SetFilePointer seems
+ * to confirm this.
+ */
rv = apr_get_os_error();
- else {
+ else
rv = APR_SUCCESS;
+
+ if (rv == APR_SUCCESS) {
thefile->eof_hit = thefile->bufpos = thefile->dataRead = 0;
thefile->filePtr = pos;
}