{"action":"created","comment":{"url":"https://api.github.com/repos/krb5/krb5/pulls/comments/208279560","pull_request_review_id":144055982,"id":208279560,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODI3OTU2MA==","diff_hunk":"@@ -42,38 +42,37 @@ krb5_read_password(krb5_context context,\n                    const char *prompt, const char *prompt2,\n                    char *return_pwd, unsigned int *size_return)\n {\n-    krb5_data reply_data;\n-    krb5_prompt k5prompt;\n+    krb5_data reply_data, verify_data;\n+    krb5_prompt k5prompt, vprompt;\n     krb5_error_code retval;\n-    reply_data.length = *size_return; /* NB: size_return is also an input */\n-    reply_data.data = return_pwd;\n+\n+    /* *size_return is the length of the return buffer on input. */\n+    reply_data = make_data(return_pwd, *size_return);\n     k5prompt.prompt = (char *)prompt;\n     k5prompt.hidden = 1;\n     k5prompt.reply = &reply_data;\n-    retval =  krb5_prompter_posix(NULL,\n-                                  NULL, NULL, NULL, 1, &k5prompt);\n-\n-    if ((retval==0) && prompt2) {\n-        krb5_data verify_data;\n-        verify_data.data = malloc(*size_return);\n-        verify_data.length = *size_return;\n-        k5prompt.prompt = (char *)prompt2;\n-        k5prompt.reply = &verify_data;\n-        if (!verify_data.data)\n-            return ENOMEM;\n-        retval = krb5_prompter_posix(NULL,\n-                                     NULL,NULL, NULL, 1, &k5prompt);\n-        if (retval == 0) {\n-            /* compare */\n-            if (strncmp(return_pwd, (char *)verify_data.data, *size_return))\n+    retval = krb5_prompter_posix(NULL, NULL, NULL, NULL, 1, &k5prompt);\n+\n+    if (retval == 0 && prompt2 != NULL) {\n+        retval = alloc_data(&verify_data, *size_return);\n+        if (retval) {","path":"src/lib/krb5/os/read_pwd.c","position":37,"original_position":37,"commit_id":"7b6a309066cc06faaee675219316d88b71cbf4f3","original_commit_id":"ec8bafdc6698b03c5316c8a1f4188e77b86b1637","user":{"login":"frozencemetery","id":468294,"node_id":"MDQ6VXNlcjQ2ODI5NA==","avatar_url":"https://avatars3.githubusercontent.com/u/468294?v=4","gravatar_id":"","url":"https://api.github.com/users/frozencemetery","html_url":"https://github.com/frozencemetery","followers_url":"https://api.github.com/users/frozencemetery/followers","following_url":"https://api.github.com/users/frozencemetery/following{/other_user}","gists_url":"https://api.github.com/users/frozencemetery/gists{/gist_id}","starred_url":"https://api.github.com/users/frozencemetery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frozencemetery/subscriptions","organizations_url":"https://api.github.com/users/frozencemetery/orgs","repos_url":"https://api.github.com/users/frozencemetery/repos","events_url":"https://api.github.com/users/frozencemetery/events{/privacy}","received_events_url":"https://api.github.com/users/frozencemetery/received_events","type":"User","site_admin":false},"body":"If you're already doing a modernize commit, can you flatten the control flow using something like `goto done`?","created_at":"2018-08-07T15:33:16Z","updated_at":"2018-08-07T15:33:31Z","html_url":"https://github.com/krb5/krb5/pull/824#discussion_r208279560","pull_request_url":"https://api.github.com/repos/krb5/krb5/pulls/824","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/krb5/krb5/pulls/comments/208279560"},"html":{"href":"https://github.com/krb5/krb5/pull/824#discussion_r208279560"},"pull_request":{"href":"https://api.github.com/repos/krb5/krb5/pulls/824"}}},"pull_request":{"url":"https://api.github.com/repos/krb5/krb5/pulls/824","id":206540020,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2NTQwMDIw","html_url":"https://github.com/krb5/krb5/pull/824","diff_url":"https://github.com/krb5/krb5/pull/824.diff","patch_url":"https://github.com/krb5/krb5/pull/824.patch","issue_url":"https://api.github.com/repos/krb5/krb5/issues/824","number":824,"state":"open","locked":false,"title":"asan fixes","user":{"login":"greghudson","id":1131421,"node_id":"MDQ6VXNlcjExMzE0MjE=","avatar_url":"https://avatars2.githubusercontent.com/u/1131421?v=4","gravatar_id":"","url":"https://api.github.com/users/greghudson","html_url":"https://github.com/greghudson","followers_url":"https://api.github.com/users/greghudson/followers","following_url":"https://api.github.com/users/greghudson/following{/other_user}","gists_url":"https://api.github.com/users/greghudson/gists{/gist_id}","starred_url":"https://api.github.com/users/greghudson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greghudson/subscriptions","organizations_url":"https://api.github.com/users/greghudson/orgs","repos_url":"https://api.github.com/users/greghudson/repos","events_url":"https://api.github.com/users/greghudson/events{/privacy}","received_events_url":"https://api.github.com/users/greghudson/received_events","type":"User","site_admin":false},"body":"A new dev machine means a new version of clang, which means new things detected by clang.  One of these is a harmless-in-practice memory bug in krb5_read_password() which has been present since 2004: if prompt2 is given, k5prompt.reply is pointed at a krb5_data object inside an inner scope, and then `k5prompt.reply->length`` is referenced just after that object goes out of scope.  Since there are no new stack allocations in the interim, it works.  I didn't make the fix minimal since there's no need to backport it.\r\n","created_at":"2018-08-06T23:11:49Z","updated_at":"2018-08-07T15:33:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bae0276a5f5048b3992d2bd5d664e98e9e76cf7c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/krb5/krb5/pulls/824/commits","review_comments_url":"https://api.github.com/repos/krb5/krb5/pulls/824/comments","review_comment_url":"https://api.github.com/repos/krb5/krb5/pulls/comments{/number}","comments_url":"https://api.github.com/repos/krb5/krb5/issues/824/comments","statuses_url":"https://api.github.com/repos/krb5/krb5/statuses/7b6a309066cc06faaee675219316d88b71cbf4f3","head":{"label":"greghudson:asan-fixes","ref":"asan-fixes","sha":"7b6a309066cc06faaee675219316d88b71cbf4f3","user":{"login":"greghudson","id":1131421,"node_id":"MDQ6VXNlcjExMzE0MjE=","avatar_url":"https://avatars2.githubusercontent.com/u/1131421?v=4","gravatar_id":"","url":"https://api.github.com/users/greghudson","html_url":"https://github.com/greghudson","followers_url":"https://api.github.com/users/greghudson/followers","following_url":"https://api.github.com/users/greghudson/following{/other_user}","gists_url":"https://api.github.com/users/greghudson/gists{/gist_id}","starred_url":"https://api.github.com/users/greghudson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greghudson/subscriptions","organizations_url":"https://api.github.com/users/greghudson/orgs","repos_url":"https://api.github.com/users/greghudson/repos","events_url":"https://api.github.com/users/greghudson/events{/privacy}","received_events_url":"https://api.github.com/users/greghudson/received_events","type":"User","site_admin":false},"repo":{"id":4423904,"node_id":"MDEwOlJlcG9zaXRvcnk0NDIzOTA0","name":"krb5","full_name":"greghudson/krb5","owner":{"login":"greghudson","id":1131421,"node_id":"MDQ6VXNlcjExMzE0MjE=","avatar_url":"https://avatars2.githubusercontent.com/u/1131421?v=4","gravatar_id":"","url":"https://api.github.com/users/greghudson","html_url":"https://github.com/greghudson","followers_url":"https://api.github.com/users/greghudson/followers","following_url":"https://api.github.com/users/greghudson/following{/other_user}","gists_url":"https://api.github.com/users/greghudson/gists{/gist_id}","starred_url":"https://api.github.com/users/greghudson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greghudson/subscriptions","organizations_url":"https://api.github.com/users/greghudson/orgs","repos_url":"https://api.github.com/users/greghudson/repos","events_url":"https://api.github.com/users/greghudson/events{/privacy}","received_events_url":"https://api.github.com/users/greghudson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/greghudson/krb5","description":"mirror of MIT krb5 repository","fork":true,"url":"https://api.github.com/repos/greghudson/krb5","forks_url":"https://api.github.com/repos/greghudson/krb5/forks","keys_url":"https://api.github.com/repos/greghudson/krb5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greghudson/krb5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greghudson/krb5/teams","hooks_url":"https://api.github.com/repos/greghudson/krb5/hooks","issue_events_url":"https://api.github.com/repos/greghudson/krb5/issues/events{/number}","events_url":"https://api.github.com/repos/greghudson/krb5/events","assignees_url":"https://api.github.com/repos/greghudson/krb5/assignees{/user}","branches_url":"https://api.github.com/repos/greghudson/krb5/branches{/branch}","tags_url":"https://api.github.com/repos/greghudson/krb5/tags","blobs_url":"https://api.github.com/repos/greghudson/krb5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greghudson/krb5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greghudson/krb5/git/refs{/sha}","trees_url":"https://api.github.com/repos/greghudson/krb5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greghudson/krb5/statuses/{sha}","languages_url":"https://api.github.com/repos/greghudson/krb5/languages","stargazers_url":"https://api.github.com/repos/greghudson/krb5/stargazers","contributors_url":"https://api.github.com/repos/greghudson/krb5/contributors","subscribers_url":"https://api.github.com/repos/greghudson/krb5/subscribers","subscription_url":"https://api.github.com/repos/greghudson/krb5/subscription","commits_url":"https://api.github.com/repos/greghudson/krb5/commits{/sha}","git_commits_url":"https://api.github.com/repos/greghudson/krb5/git/commits{/sha}","comments_url":"https://api.github.com/repos/greghudson/krb5/comments{/number}","issue_comment_url":"https://api.github.com/repos/greghudson/krb5/issues/comments{/number}","contents_url":"https://api.github.com/repos/greghudson/krb5/contents/{+path}","compare_url":"https://api.github.com/repos/greghudson/krb5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greghudson/krb5/merges","archive_url":"https://api.github.com/repos/greghudson/krb5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greghudson/krb5/downloads","issues_url":"https://api.github.com/repos/greghudson/krb5/issues{/number}","pulls_url":"https://api.github.com/repos/greghudson/krb5/pulls{/number}","milestones_url":"https://api.github.com/repos/greghudson/krb5/milestones{/number}","notifications_url":"https://api.github.com/repos/greghudson/krb5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greghudson/krb5/labels{/name}","releases_url":"https://api.github.com/repos/greghudson/krb5/releases{/id}","deployments_url":"https://api.github.com/repos/greghudson/krb5/deployments","created_at":"2012-05-23T18:43:39Z","updated_at":"2015-01-06T02:06:38Z","pushed_at":"2018-08-06T22:56:02Z","git_url":"git://github.com/greghudson/krb5.git","ssh_url":"git@github.com:greghudson/krb5.git","clone_url":"https://github.com/greghudson/krb5.git","svn_url":"https://github.com/greghudson/krb5","homepage":null,"size":63506,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":2,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"krb5:master","ref":"master","sha":"013de5c54eafebf5aa3fae82821c21ca2072040d","user":{"login":"krb5","id":523797,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyMzc5Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/523797?v=4","gravatar_id":"","url":"https://api.github.com/users/krb5","html_url":"https://github.com/krb5","followers_url":"https://api.github.com/users/krb5/followers","following_url":"https://api.github.com/users/krb5/following{/other_user}","gists_url":"https://api.github.com/users/krb5/gists{/gist_id}","starred_url":"https://api.github.com/users/krb5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krb5/subscriptions","organizations_url":"https://api.github.com/users/krb5/orgs","repos_url":"https://api.github.com/users/krb5/repos","events_url":"https://api.github.com/users/krb5/events{/privacy}","received_events_url":"https://api.github.com/users/krb5/received_events","type":"Organization","site_admin":false},"repo":{"id":4307702,"node_id":"MDEwOlJlcG9zaXRvcnk0MzA3NzAy","name":"krb5","full_name":"krb5/krb5","owner":{"login":"krb5","id":523797,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyMzc5Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/523797?v=4","gravatar_id":"","url":"https://api.github.com/users/krb5","html_url":"https://github.com/krb5","followers_url":"https://api.github.com/users/krb5/followers","following_url":"https://api.github.com/users/krb5/following{/other_user}","gists_url":"https://api.github.com/users/krb5/gists{/gist_id}","starred_url":"https://api.github.com/users/krb5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krb5/subscriptions","organizations_url":"https://api.github.com/users/krb5/orgs","repos_url":"https://api.github.com/users/krb5/repos","events_url":"https://api.github.com/users/krb5/events{/privacy}","received_events_url":"https://api.github.com/users/krb5/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/krb5/krb5","description":"mirror of MIT krb5 repository","fork":false,"url":"https://api.github.com/repos/krb5/krb5","forks_url":"https://api.github.com/repos/krb5/krb5/forks","keys_url":"https://api.github.com/repos/krb5/krb5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/krb5/krb5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/krb5/krb5/teams","hooks_url":"https://api.github.com/repos/krb5/krb5/hooks","issue_events_url":"https://api.github.com/repos/krb5/krb5/issues/events{/number}","events_url":"https://api.github.com/repos/krb5/krb5/events","assignees_url":"https://api.github.com/repos/krb5/krb5/assignees{/user}","branches_url":"https://api.github.com/repos/krb5/krb5/branches{/branch}","tags_url":"https://api.github.com/repos/krb5/krb5/tags","blobs_url":"https://api.github.com/repos/krb5/krb5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/krb5/krb5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/krb5/krb5/git/refs{/sha}","trees_url":"https://api.github.com/repos/krb5/krb5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/krb5/krb5/statuses/{sha}","languages_url":"https://api.github.com/repos/krb5/krb5/languages","stargazers_url":"https://api.github.com/repos/krb5/krb5/stargazers","contributors_url":"https://api.github.com/repos/krb5/krb5/contributors","subscribers_url":"https://api.github.com/repos/krb5/krb5/subscribers","subscription_url":"https://api.github.com/repos/krb5/krb5/subscription","commits_url":"https://api.github.com/repos/krb5/krb5/commits{/sha}","git_commits_url":"https://api.github.com/repos/krb5/krb5/git/commits{/sha}","comments_url":"https://api.github.com/repos/krb5/krb5/comments{/number}","issue_comment_url":"https://api.github.com/repos/krb5/krb5/issues/comments{/number}","contents_url":"https://api.github.com/repos/krb5/krb5/contents/{+path}","compare_url":"https://api.github.com/repos/krb5/krb5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/krb5/krb5/merges","archive_url":"https://api.github.com/repos/krb5/krb5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/krb5/krb5/downloads","issues_url":"https://api.github.com/repos/krb5/krb5/issues{/number}","pulls_url":"https://api.github.com/repos/krb5/krb5/pulls{/number}","milestones_url":"https://api.github.com/repos/krb5/krb5/milestones{/number}","notifications_url":"https://api.github.com/repos/krb5/krb5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/krb5/krb5/labels{/name}","releases_url":"https://api.github.com/repos/krb5/krb5/releases{/id}","deployments_url":"https://api.github.com/repos/krb5/krb5/deployments","created_at":"2012-05-12T16:01:32Z","updated_at":"2018-08-05T13:47:22Z","pushed_at":"2018-08-06T23:11:49Z","git_url":"git://github.com/krb5/krb5.git","ssh_url":"git@github.com:krb5/krb5.git","clone_url":"https://github.com/krb5/krb5.git","svn_url":"https://github.com/krb5/krb5","homepage":null,"size":69885,"stargazers_count":183,"watchers_count":183,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":168,"mirror_url":null,"archived":false,"open_issues_count":17,"license":null,"forks":168,"open_issues":17,"watchers":183,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/krb5/krb5/pulls/824"},"html":{"href":"https://github.com/krb5/krb5/pull/824"},"issue":{"href":"https://api.github.com/repos/krb5/krb5/issues/824"},"comments":{"href":"https://api.github.com/repos/krb5/krb5/issues/824/comments"},"review_comments":{"href":"https://api.github.com/repos/krb5/krb5/pulls/824/comments"},"review_comment":{"href":"https://api.github.com/repos/krb5/krb5/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/krb5/krb5/pulls/824/commits"},"statuses":{"href":"https://api.github.com/repos/krb5/krb5/statuses/7b6a309066cc06faaee675219316d88b71cbf4f3"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"frozencemetery"}}