{"action":"created","issue":{"url":"https://api.github.com/repos/grke/burp/issues/723","repository_url":"https://api.github.com/repos/grke/burp","labels_url":"https://api.github.com/repos/grke/burp/issues/723/labels{/name}","comments_url":"https://api.github.com/repos/grke/burp/issues/723/comments","events_url":"https://api.github.com/repos/grke/burp/issues/723/events","html_url":"https://github.com/grke/burp/issues/723","id":328830177,"node_id":"MDU6SXNzdWUzMjg4MzAxNzc=","number":723,"title":"iobuf_to_printable does not behave as expected","user":{"login":"Iznohak","id":39733050,"node_id":"MDQ6VXNlcjM5NzMzMDUw","avatar_url":"https://avatars1.githubusercontent.com/u/39733050?v=4","gravatar_id":"","url":"https://api.github.com/users/Iznohak","html_url":"https://github.com/Iznohak","followers_url":"https://api.github.com/users/Iznohak/followers","following_url":"https://api.github.com/users/Iznohak/following{/other_user}","gists_url":"https://api.github.com/users/Iznohak/gists{/gist_id}","starred_url":"https://api.github.com/users/Iznohak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Iznohak/subscriptions","organizations_url":"https://api.github.com/users/Iznohak/orgs","repos_url":"https://api.github.com/users/Iznohak/repos","events_url":"https://api.github.com/users/Iznohak/events{/privacy}","received_events_url":"https://api.github.com/users/Iznohak/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-03T13:46:47Z","updated_at":"2018-06-06T07:02:44Z","closed_at":null,"author_association":"NONE","body":"A simple test case to demonstrate:\r\n- Server version 2.2.4\r\n- Client version 2.2.2\r\n- version_warn set to 1 on both client and server (the default)\r\n1. Client connects to server\r\n2. Server prints \"WARNING: Client '_cname_' version '2.2.2' does not match server version '2.2.4'. An upgrade is recommended.\"\r\n\r\nExpected result: client should also print \"WARNING: Client '_cname_' version '2.2.2' does not match server version '2.2.4'. An upgrade is recommended.\"\r\nActual result: client prints \"WARNING: w:0066:(binary data)\"\r\n\r\nThe issue actually lies in is_printable (iobuf.c):\r\n```\r\nstatic int is_printable(struct iobuf *iobuf)\r\n{\r\n\tsize_t l;\r\n\tfor(l=0; l<iobuf->len; l++)\r\n\t\tif(!isprint(iobuf->buf[l]))\r\n\t\t\treturn 0;\r\n\treturn 1;\r\n}\r\n```\r\nwhich returns 0 because warning messages are terminated by a newline character ('\\n'), which is not considered printable by isprint().\r\n\r\nPossible suggested fix:\r\n```\r\n\t\tif(!isprint(iobuf->buf[l]) && !isspace(iobuf->buf[l]))\r\n```\r\nisspace() will accept linefeed and tab characters (good), but also carriage return, form feed and vertical tab (perhaps not so good).\r\n\r\nOr simply:\r\n```\r\n\t\tif(!isprint(iobuf->buf[l]) && (iobuf->[l] != '\\n'))\r\n```\r\nwhich might be too specific.\r\n\r\nHope this helps. Thanks."},"comment":{"url":"https://api.github.com/repos/grke/burp/issues/comments/394962575","html_url":"https://github.com/grke/burp/issues/723#issuecomment-394962575","issue_url":"https://api.github.com/repos/grke/burp/issues/723","id":394962575,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDk2MjU3NQ==","user":{"login":"grke","id":695039,"node_id":"MDQ6VXNlcjY5NTAzOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/695039?v=4","gravatar_id":"","url":"https://api.github.com/users/grke","html_url":"https://github.com/grke","followers_url":"https://api.github.com/users/grke/followers","following_url":"https://api.github.com/users/grke/following{/other_user}","gists_url":"https://api.github.com/users/grke/gists{/gist_id}","starred_url":"https://api.github.com/users/grke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grke/subscriptions","organizations_url":"https://api.github.com/users/grke/orgs","repos_url":"https://api.github.com/users/grke/repos","events_url":"https://api.github.com/users/grke/events{/privacy}","received_events_url":"https://api.github.com/users/grke/received_events","type":"User","site_admin":false},"created_at":"2018-06-06T07:02:44Z","updated_at":"2018-06-06T07:02:44Z","author_association":"OWNER","body":"Hello,\r\n\r\nThanks for the ideas. I agree that only log.c should append newlines when logging directly on the host.\r\nI also agree that the suggested fix is fine for now."}}
{"actor":{"display_login":"grke"}}