diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/common/file.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index 4b7865d724..38ae3cb912 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -227,15 +227,14 @@ int lseek(int fd, int offset, int whence) | |||
227 | break; | 227 | break; |
228 | 228 | ||
229 | case SEEK_END: | 229 | case SEEK_END: |
230 | pos = openfiles[fd].size - offset; | 230 | pos = openfiles[fd].size + offset; |
231 | break; | 231 | break; |
232 | 232 | ||
233 | default: | 233 | default: |
234 | errno = EINVAL; | 234 | errno = EINVAL; |
235 | return -1; | 235 | return -1; |
236 | } | 236 | } |
237 | if ( (pos < 0) || | 237 | if ((pos < 0) || (pos > openfiles[fd].size)) { |
238 | (pos > openfiles[fd].size) ) { | ||
239 | errno = EINVAL; | 238 | errno = EINVAL; |
240 | return -1; | 239 | return -1; |
241 | } | 240 | } |