{"action":"created","comment":{"url":"https://api.github.com/repos/torproject/tor/pulls/comments/198222832","pull_request_review_id":132114915,"id":198222832,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODIyMjgzMg==","diff_hunk":"@@ -114,14 +247,56 @@ int\n fetch_from_buf_socks(buf_t *buf, socks_request_t *req,\n                      int log_sockstype, int safe_socks)\n {\n-  int res;\n+  int res = 0;\n+  size_t datalen = buf_datalen(buf);\n+  uint8_t *raw_data;\n+  uint8_t socks_version;\n+\n+  raw_data = tor_malloc(datalen);\n+  memset(raw_data, 0, datalen);\n+\n+  buf_peek(buf, (char *)raw_data, datalen);\n+\n+  socks_version = (uint8_t)raw_data[0];\n+\n+  if (socks_version == 4) {\n+    if (datalen < SOCKS4_NETWORK_LEN) {\n+      res = 0;\n+      goto end;\n+    }\n+\n+    int is_socks4a = 0;\n+    int parse_status =\n+      parse_socks4_request((const uint8_t *)raw_data, req, datalen,\n+                           &is_socks4a);\n+\n+    if (parse_status != 1) {\n+      res = parse_status;\n+      goto end;\n+    }\n+\n+    int process_status = process_socks4_request(req, is_socks4a,\n+                                                log_sockstype,\n+                                                safe_socks);\n+\n+    if (process_status != 1) {\n+      res = process_status;\n+      goto end;\n+    }\n+\n+    buf_clear(buf);\n+    res = 1;\n+    goto end;\n+  }\n+\n   ssize_t n_drain;\n   size_t want_length = 128;\n   const char *head = NULL;\n-  size_t datalen = 0;\n \n-  if (buf_datalen(buf) < 2) /* version and another byte */\n-    return 0;\n+  if (buf_datalen(buf) < 2) { /* version and another byte */","path":"src/or/proto_socks.c","position":null,"original_position":201,"commit_id":"78458d8fae85366499ce6bccd52604c6c05d4526","original_commit_id":"0c21c9440a928f413fc16b782628d92fb7232729","user":{"login":"rl1987","id":1080220,"node_id":"MDQ6VXNlcjEwODAyMjA=","avatar_url":"https://avatars1.githubusercontent.com/u/1080220?v=4","gravatar_id":"","url":"https://api.github.com/users/rl1987","html_url":"https://github.com/rl1987","followers_url":"https://api.github.com/users/rl1987/followers","following_url":"https://api.github.com/users/rl1987/following{/other_user}","gists_url":"https://api.github.com/users/rl1987/gists{/gist_id}","starred_url":"https://api.github.com/users/rl1987/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rl1987/subscriptions","organizations_url":"https://api.github.com/users/rl1987/orgs","repos_url":"https://api.github.com/users/rl1987/repos","events_url":"https://api.github.com/users/rl1987/events{/privacy}","received_events_url":"https://api.github.com/users/rl1987/received_events","type":"User","site_admin":false},"body":"Fixed later in the branch.","created_at":"2018-06-26T17:00:07Z","updated_at":"2018-06-26T17:00:08Z","html_url":"https://github.com/torproject/tor/pull/180#discussion_r198222832","pull_request_url":"https://api.github.com/repos/torproject/tor/pulls/180","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/torproject/tor/pulls/comments/198222832"},"html":{"href":"https://github.com/torproject/tor/pull/180#discussion_r198222832"},"pull_request":{"href":"https://api.github.com/repos/torproject/tor/pulls/180"}},"in_reply_to_id":198179308},"pull_request":{"url":"https://api.github.com/repos/torproject/tor/pulls/180","id":197371523,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3MzcxNTIz","html_url":"https://github.com/torproject/tor/pull/180","diff_url":"https://github.com/torproject/tor/pull/180.diff","patch_url":"https://github.com/torproject/tor/pull/180.patch","issue_url":"https://api.github.com/repos/torproject/tor/issues/180","number":180,"state":"open","locked":false,"title":"#3569 part 1: Rework SOCKS5 server code with trunnel","user":{"login":"rl1987","id":1080220,"node_id":"MDQ6VXNlcjEwODAyMjA=","avatar_url":"https://avatars1.githubusercontent.com/u/1080220?v=4","gravatar_id":"","url":"https://api.github.com/users/rl1987","html_url":"https://github.com/rl1987","followers_url":"https://api.github.com/users/rl1987/followers","following_url":"https://api.github.com/users/rl1987/following{/other_user}","gists_url":"https://api.github.com/users/rl1987/gists{/gist_id}","starred_url":"https://api.github.com/users/rl1987/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rl1987/subscriptions","organizations_url":"https://api.github.com/users/rl1987/orgs","repos_url":"https://api.github.com/users/rl1987/repos","events_url":"https://api.github.com/users/rl1987/events{/privacy}","received_events_url":"https://api.github.com/users/rl1987/received_events","type":"User","site_admin":false},"body":"https://trac.torproject.org/projects/tor/ticket/3569","created_at":"2018-06-26T10:16:42Z","updated_at":"2018-06-26T17:00:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00498145ae6edade2cea8330316507ea24c38012","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/torproject/tor/pulls/180/commits","review_comments_url":"https://api.github.com/repos/torproject/tor/pulls/180/comments","review_comment_url":"https://api.github.com/repos/torproject/tor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/torproject/tor/issues/180/comments","statuses_url":"https://api.github.com/repos/torproject/tor/statuses/78458d8fae85366499ce6bccd52604c6c05d4526","head":{"label":"rl1987:socks_trunnel4","ref":"socks_trunnel4","sha":"78458d8fae85366499ce6bccd52604c6c05d4526","user":{"login":"rl1987","id":1080220,"node_id":"MDQ6VXNlcjEwODAyMjA=","avatar_url":"https://avatars1.githubusercontent.com/u/1080220?v=4","gravatar_id":"","url":"https://api.github.com/users/rl1987","html_url":"https://github.com/rl1987","followers_url":"https://api.github.com/users/rl1987/followers","following_url":"https://api.github.com/users/rl1987/following{/other_user}","gists_url":"https://api.github.com/users/rl1987/gists{/gist_id}","starred_url":"https://api.github.com/users/rl1987/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rl1987/subscriptions","organizations_url":"https://api.github.com/users/rl1987/orgs","repos_url":"https://api.github.com/users/rl1987/repos","events_url":"https://api.github.com/users/rl1987/events{/privacy}","received_events_url":"https://api.github.com/users/rl1987/received_events","type":"User","site_admin":false},"repo":{"id":132449475,"node_id":"MDEwOlJlcG9zaXRvcnkxMzI0NDk0NzU=","name":"tor","full_name":"rl1987/tor","owner":{"login":"rl1987","id":1080220,"node_id":"MDQ6VXNlcjEwODAyMjA=","avatar_url":"https://avatars1.githubusercontent.com/u/1080220?v=4","gravatar_id":"","url":"https://api.github.com/users/rl1987","html_url":"https://github.com/rl1987","followers_url":"https://api.github.com/users/rl1987/followers","following_url":"https://api.github.com/users/rl1987/following{/other_user}","gists_url":"https://api.github.com/users/rl1987/gists{/gist_id}","starred_url":"https://api.github.com/users/rl1987/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rl1987/subscriptions","organizations_url":"https://api.github.com/users/rl1987/orgs","repos_url":"https://api.github.com/users/rl1987/repos","events_url":"https://api.github.com/users/rl1987/events{/privacy}","received_events_url":"https://api.github.com/users/rl1987/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rl1987/tor","description":"unofficial git repo -- report bugs/issues/pull requests on https://trac.torproject.org/ --","fork":true,"url":"https://api.github.com/repos/rl1987/tor","forks_url":"https://api.github.com/repos/rl1987/tor/forks","keys_url":"https://api.github.com/repos/rl1987/tor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rl1987/tor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rl1987/tor/teams","hooks_url":"https://api.github.com/repos/rl1987/tor/hooks","issue_events_url":"https://api.github.com/repos/rl1987/tor/issues/events{/number}","events_url":"https://api.github.com/repos/rl1987/tor/events","assignees_url":"https://api.github.com/repos/rl1987/tor/assignees{/user}","branches_url":"https://api.github.com/repos/rl1987/tor/branches{/branch}","tags_url":"https://api.github.com/repos/rl1987/tor/tags","blobs_url":"https://api.github.com/repos/rl1987/tor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rl1987/tor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rl1987/tor/git/refs{/sha}","trees_url":"https://api.github.com/repos/rl1987/tor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rl1987/tor/statuses/{sha}","languages_url":"https://api.github.com/repos/rl1987/tor/languages","stargazers_url":"https://api.github.com/repos/rl1987/tor/stargazers","contributors_url":"https://api.github.com/repos/rl1987/tor/contributors","subscribers_url":"https://api.github.com/repos/rl1987/tor/subscribers","subscription_url":"https://api.github.com/repos/rl1987/tor/subscription","commits_url":"https://api.github.com/repos/rl1987/tor/commits{/sha}","git_commits_url":"https://api.github.com/repos/rl1987/tor/git/commits{/sha}","comments_url":"https://api.github.com/repos/rl1987/tor/comments{/number}","issue_comment_url":"https://api.github.com/repos/rl1987/tor/issues/comments{/number}","contents_url":"https://api.github.com/repos/rl1987/tor/contents/{+path}","compare_url":"https://api.github.com/repos/rl1987/tor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rl1987/tor/merges","archive_url":"https://api.github.com/repos/rl1987/tor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rl1987/tor/downloads","issues_url":"https://api.github.com/repos/rl1987/tor/issues{/number}","pulls_url":"https://api.github.com/repos/rl1987/tor/pulls{/number}","milestones_url":"https://api.github.com/repos/rl1987/tor/milestones{/number}","notifications_url":"https://api.github.com/repos/rl1987/tor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rl1987/tor/labels{/name}","releases_url":"https://api.github.com/repos/rl1987/tor/releases{/id}","deployments_url":"https://api.github.com/repos/rl1987/tor/deployments","created_at":"2018-05-07T11:14:09Z","updated_at":"2018-06-26T10:18:30Z","pushed_at":"2018-06-26T16:52:19Z","git_url":"git://github.com/rl1987/tor.git","ssh_url":"git@github.com:rl1987/tor.git","clone_url":"https://github.com/rl1987/tor.git","svn_url":"https://github.com/rl1987/tor","homepage":"https://gitweb.torproject.org/tor.git","size":103441,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"torproject:master","ref":"master","sha":"b556894ef2fc41947bcae998c8caa51e256f2a6e","user":{"login":"torproject","id":4099049,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwOTkwNDk=","avatar_url":"https://avatars2.githubusercontent.com/u/4099049?v=4","gravatar_id":"","url":"https://api.github.com/users/torproject","html_url":"https://github.com/torproject","followers_url":"https://api.github.com/users/torproject/followers","following_url":"https://api.github.com/users/torproject/following{/other_user}","gists_url":"https://api.github.com/users/torproject/gists{/gist_id}","starred_url":"https://api.github.com/users/torproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torproject/subscriptions","organizations_url":"https://api.github.com/users/torproject/orgs","repos_url":"https://api.github.com/users/torproject/repos","events_url":"https://api.github.com/users/torproject/events{/privacy}","received_events_url":"https://api.github.com/users/torproject/received_events","type":"Organization","site_admin":false},"repo":{"id":10513590,"node_id":"MDEwOlJlcG9zaXRvcnkxMDUxMzU5MA==","name":"tor","full_name":"torproject/tor","owner":{"login":"torproject","id":4099049,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwOTkwNDk=","avatar_url":"https://avatars2.githubusercontent.com/u/4099049?v=4","gravatar_id":"","url":"https://api.github.com/users/torproject","html_url":"https://github.com/torproject","followers_url":"https://api.github.com/users/torproject/followers","following_url":"https://api.github.com/users/torproject/following{/other_user}","gists_url":"https://api.github.com/users/torproject/gists{/gist_id}","starred_url":"https://api.github.com/users/torproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torproject/subscriptions","organizations_url":"https://api.github.com/users/torproject/orgs","repos_url":"https://api.github.com/users/torproject/repos","events_url":"https://api.github.com/users/torproject/events{/privacy}","received_events_url":"https://api.github.com/users/torproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/torproject/tor","description":"unofficial git repo -- report bugs/issues/pull requests on https://trac.torproject.org/ --","fork":false,"url":"https://api.github.com/repos/torproject/tor","forks_url":"https://api.github.com/repos/torproject/tor/forks","keys_url":"https://api.github.com/repos/torproject/tor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/torproject/tor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/torproject/tor/teams","hooks_url":"https://api.github.com/repos/torproject/tor/hooks","issue_events_url":"https://api.github.com/repos/torproject/tor/issues/events{/number}","events_url":"https://api.github.com/repos/torproject/tor/events","assignees_url":"https://api.github.com/repos/torproject/tor/assignees{/user}","branches_url":"https://api.github.com/repos/torproject/tor/branches{/branch}","tags_url":"https://api.github.com/repos/torproject/tor/tags","blobs_url":"https://api.github.com/repos/torproject/tor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/torproject/tor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/torproject/tor/git/refs{/sha}","trees_url":"https://api.github.com/repos/torproject/tor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/torproject/tor/statuses/{sha}","languages_url":"https://api.github.com/repos/torproject/tor/languages","stargazers_url":"https://api.github.com/repos/torproject/tor/stargazers","contributors_url":"https://api.github.com/repos/torproject/tor/contributors","subscribers_url":"https://api.github.com/repos/torproject/tor/subscribers","subscription_url":"https://api.github.com/repos/torproject/tor/subscription","commits_url":"https://api.github.com/repos/torproject/tor/commits{/sha}","git_commits_url":"https://api.github.com/repos/torproject/tor/git/commits{/sha}","comments_url":"https://api.github.com/repos/torproject/tor/comments{/number}","issue_comment_url":"https://api.github.com/repos/torproject/tor/issues/comments{/number}","contents_url":"https://api.github.com/repos/torproject/tor/contents/{+path}","compare_url":"https://api.github.com/repos/torproject/tor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/torproject/tor/merges","archive_url":"https://api.github.com/repos/torproject/tor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/torproject/tor/downloads","issues_url":"https://api.github.com/repos/torproject/tor/issues{/number}","pulls_url":"https://api.github.com/repos/torproject/tor/pulls{/number}","milestones_url":"https://api.github.com/repos/torproject/tor/milestones{/number}","notifications_url":"https://api.github.com/repos/torproject/tor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/torproject/tor/labels{/name}","releases_url":"https://api.github.com/repos/torproject/tor/releases{/id}","deployments_url":"https://api.github.com/repos/torproject/tor/deployments","created_at":"2013-06-05T21:50:25Z","updated_at":"2018-06-26T16:18:27Z","pushed_at":"2018-06-26T16:52:20Z","git_url":"git://github.com/torproject/tor.git","ssh_url":"git@github.com:torproject/tor.git","clone_url":"https://github.com/torproject/tor.git","svn_url":"https://github.com/torproject/tor","homepage":"https://gitweb.torproject.org/tor.git","size":104713,"stargazers_count":717,"watchers_count":717,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":284,"mirror_url":null,"archived":false,"open_issues_count":26,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":284,"open_issues":26,"watchers":717,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/torproject/tor/pulls/180"},"html":{"href":"https://github.com/torproject/tor/pull/180"},"issue":{"href":"https://api.github.com/repos/torproject/tor/issues/180"},"comments":{"href":"https://api.github.com/repos/torproject/tor/issues/180/comments"},"review_comments":{"href":"https://api.github.com/repos/torproject/tor/pulls/180/comments"},"review_comment":{"href":"https://api.github.com/repos/torproject/tor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/torproject/tor/pulls/180/commits"},"statuses":{"href":"https://api.github.com/repos/torproject/tor/statuses/78458d8fae85366499ce6bccd52604c6c05d4526"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"rl1987"}}