{"action":"opened","issue":{"url":"https://api.github.com/repos/pjdavis/radiustar/issues/23","labels_url":"https://api.github.com/repos/pjdavis/radiustar/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/pjdavis/radiustar/issues/23/comments","events_url":"https://api.github.com/repos/pjdavis/radiustar/issues/23/events","html_url":"https://github.com/pjdavis/radiustar/issues/23","id":75931044,"number":23,"title":"Reading vendor specific attributes is bugged","user":{"login":"gml1980","id":1470052,"avatar_url":"https://avatars.githubusercontent.com/u/1470052?v=3","gravatar_id":"","url":"https://api.github.com/users/gml1980","html_url":"https://github.com/gml1980","followers_url":"https://api.github.com/users/gml1980/followers","following_url":"https://api.github.com/users/gml1980/following{/other_user}","gists_url":"https://api.github.com/users/gml1980/gists{/gist_id}","starred_url":"https://api.github.com/users/gml1980/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gml1980/subscriptions","organizations_url":"https://api.github.com/users/gml1980/orgs","repos_url":"https://api.github.com/users/gml1980/repos","events_url":"https://api.github.com/users/gml1980/events{/privacy}","received_events_url":"https://api.github.com/users/gml1980/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-13T10:15:02Z","updated_at":"2015-05-13T10:15:02Z","closed_at":null,"body":"When reading a vendor specific attribute, if there is at least one more attribute in the response which appears after the vendor specific attribute, then the extracted value is wrong as it also contains the first two bytes off the next attribute.\r\n\r\nI believe this is a problem in packet.rb with the following line:\r\n`\r\n          vid, attribute_type, attribute_value = attribute_data.unpack(\"xxNCxa#{length-6}\")\r\n`\r\n\r\nReading the unpack documentation, the values in the String passed into unpack mean:\r\nx - Skip a byte\r\nN - 32 bit unsigned integer\r\nC - 8 bit unsigned integer\r\na - Arbitrary String\r\n\r\nThis means the unpack statement skips 8 bytes, then reads in the next (length - 6) bytes as the String (so 2 bytes off the next attribute).\r\n\r\nI think the line should be:\r\n`\r\n          vid, attribute_type, attribute_value = attribute_data.unpack(\"xxNCxa#{length-8}\")\r\n`\r\n\r\nI'm at work and have never contributed to a public repository before - which is why I'm raising this as an issue with the solution in it.\r\n\r\nThanks for the gem - we use it and it's very useful."}}