Skip to content

Commit

Permalink
Check for too much data being read
Browse files Browse the repository at this point in the history
fixes #5
  • Loading branch information
khenriks committed Feb 1, 2012
1 parent ad21455 commit 032b698
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/transcode.c
Expand Up @@ -499,6 +499,10 @@ struct transcoder* transcoder_new(char *flacname) {
/* Read some bytes into the internal buffer and into the given buffer. */

int transcoder_read(struct transcoder* trans, char* buff, int offset, int len) {
/* Client asked for more data than exists. */
if (offset > trans->totalsize) {
return 0;
}
if (offset+len > trans->totalsize) {
len = trans->totalsize - offset;
}
Expand Down

0 comments on commit 032b698

Please sign in to comment.