Skip to content

Instantly share code, notes, and snippets.

@khenriks
Created February 1, 2012 00:46
Show Gist options
  • Save khenriks/1714247 to your computer and use it in GitHub Desktop.
Save khenriks/1714247 to your computer and use it in GitHub Desktop.
Patch to fix mp3fs #5
diff --git a/src/transcode.c b/src/transcode.c
index 13cbf73..bccd7d0 100644
--- a/src/transcode.c
+++ b/src/transcode.c
@@ -499,6 +499,10 @@ trans_fail:
/* 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment