{"action":"opened","issue":{"url":"https://api.github.com/repos/davecgh/go-xdr/issues/2","labels_url":"https://api.github.com/repos/davecgh/go-xdr/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/davecgh/go-xdr/issues/2/comments","events_url":"https://api.github.com/repos/davecgh/go-xdr/issues/2/events","html_url":"https://github.com/davecgh/go-xdr/issues/2","id":57836312,"number":2,"title":"Please add max size to decoder.","user":{"login":"marcopeereboom","id":4366787,"avatar_url":"https://avatars.githubusercontent.com/u/4366787?v=3","gravatar_id":"","url":"https://api.github.com/users/marcopeereboom","html_url":"https://github.com/marcopeereboom","followers_url":"https://api.github.com/users/marcopeereboom/followers","following_url":"https://api.github.com/users/marcopeereboom/following{/other_user}","gists_url":"https://api.github.com/users/marcopeereboom/gists{/gist_id}","starred_url":"https://api.github.com/users/marcopeereboom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcopeereboom/subscriptions","organizations_url":"https://api.github.com/users/marcopeereboom/orgs","repos_url":"https://api.github.com/users/marcopeereboom/repos","events_url":"https://api.github.com/users/marcopeereboom/events{/privacy}","received_events_url":"https://api.github.com/users/marcopeereboom/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-16T18:18:11Z","updated_at":"2015-02-16T18:18:11Z","closed_at":null,"body":"When reading XDR directly of the wire a remote malicious person could craft packets that could use up all of machines memory because there are no limits.  It would be helpful if we could set a limit on how large a read can be.  For example:\r\n\r\n```golang\r\ndec := NewDecoderLimited(myReader, 1024*1024) // limit to 1MB\r\n_, err := dec.Decode(&myXDR)\r\nif err == xdr.ErrTooBig {\r\n        myReader.Close()\r\n        return err\r\n}\r\n```"}}