Skip to content

Commit

Permalink
* Fixed bug with pack_seek implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbens committed Aug 30, 2009
1 parent 1922c3c commit 76671b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pack.c
Expand Up @@ -635,7 +635,7 @@ ssize_t pack_read( Packfile_t* file, void* buf, size_t count )
int bytes;

if ((file->pos + count) > file->end)
count = file->end - file->pos; /* can't go past end */
count = MAX(file->end - file->pos, 0); /* can't go past end */
if (count == 0)
return 0;

Expand Down Expand Up @@ -696,7 +696,7 @@ off_t pack_seek( Packfile_t* file, off_t offset, int whence)
target = base + offset;

/* Limit checks. */
if ((target < file->start) || (target >= file->end))
if (target < file->start)
return -1;

#if HAS_FD
Expand Down

0 comments on commit 76671b2

Please sign in to comment.