{"action":"created","comment":{"url":"https://api.github.com/repos/PBSPro/pbspro/pulls/comments/211762826","pull_request_review_id":148253356,"id":211762826,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTc2MjgyNg==","diff_hunk":"@@ -167,18 +167,24 @@ is_child_path(char *dir, char *path)\n \t\tstrncpy(fullpath, path, sizeof(fullpath));\n \t}\n \n+\tdir_real = malloc(sizeof(char) * (MAXPATHLEN + 1));\n+\tfullpath_real = malloc(sizeof(char) * (2 * MAXPATHLEN + 2));\n+\n \t/* even if the file path is relative to some directory, */\n \t/* it may use /../../ notation and escape that directory, */\n \t/* so always perform full check of parent-child directory relation */\n-\tdir_real = realpath(dir, NULL);\n-\tfullpath_real = realpath(fullpath, NULL);\n-\n-\tif (dir_real == NULL || fullpath_real == NULL)\n-\t\tgoto error_exit;\n #ifdef WIN32\n+\tforward2back_slash(fullpath);\n \tstrncpy(dir_real, lpath2short(dir), sizeof(dir_real)-1);\n \tstrncpy(fullpath_real, lpath2short(fullpath), sizeof(fullpath_real)-1);\n+#else","path":"src/resmom/stage_func.c","position":null,"original_position":19,"commit_id":"b2bfd931fa831ba4d3608f544dd94337c3fbc0f1","original_commit_id":"b2bfd931fa831ba4d3608f544dd94337c3fbc0f1","user":{"login":"mike0042","id":2702535,"node_id":"MDQ6VXNlcjI3MDI1MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/2702535?v=4","gravatar_id":"","url":"https://api.github.com/users/mike0042","html_url":"https://github.com/mike0042","followers_url":"https://api.github.com/users/mike0042/followers","following_url":"https://api.github.com/users/mike0042/following{/other_user}","gists_url":"https://api.github.com/users/mike0042/gists{/gist_id}","starred_url":"https://api.github.com/users/mike0042/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mike0042/subscriptions","organizations_url":"https://api.github.com/users/mike0042/orgs","repos_url":"https://api.github.com/users/mike0042/repos","events_url":"https://api.github.com/users/mike0042/events{/privacy}","received_events_url":"https://api.github.com/users/mike0042/received_events","type":"User","site_admin":false},"body":"The above Windows code looks incorrect because sizeof(dir_real) and sizeof(fullpath_real) will both return the size of the pointer, not the size of the malloc()'ed block.","created_at":"2018-08-21T21:15:54Z","updated_at":"2018-08-21T21:18:27Z","html_url":"https://github.com/PBSPro/pbspro/pull/755#discussion_r211762826","pull_request_url":"https://api.github.com/repos/PBSPro/pbspro/pulls/755","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/comments/211762826"},"html":{"href":"https://github.com/PBSPro/pbspro/pull/755#discussion_r211762826"},"pull_request":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/755"}}},"pull_request":{"url":"https://api.github.com/repos/PBSPro/pbspro/pulls/755","id":203610357,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzNjEwMzU3","html_url":"https://github.com/PBSPro/pbspro/pull/755","diff_url":"https://github.com/PBSPro/pbspro/pull/755.diff","patch_url":"https://github.com/PBSPro/pbspro/pull/755.patch","issue_url":"https://api.github.com/repos/PBSPro/pbspro/issues/755","number":755,"state":"open","locked":false,"title":"fix pbs_probe realpath() buffer overflow on ubuntu 16","user":{"login":"minghui-liu","id":6920446,"node_id":"MDQ6VXNlcjY5MjA0NDY=","avatar_url":"https://avatars1.githubusercontent.com/u/6920446?v=4","gravatar_id":"","url":"https://api.github.com/users/minghui-liu","html_url":"https://github.com/minghui-liu","followers_url":"https://api.github.com/users/minghui-liu/followers","following_url":"https://api.github.com/users/minghui-liu/following{/other_user}","gists_url":"https://api.github.com/users/minghui-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/minghui-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minghui-liu/subscriptions","organizations_url":"https://api.github.com/users/minghui-liu/orgs","repos_url":"https://api.github.com/users/minghui-liu/repos","events_url":"https://api.github.com/users/minghui-liu/events{/privacy}","received_events_url":"https://api.github.com/users/minghui-liu/received_events","type":"User","site_admin":false},"body":"<!--- Please review your changes in preview mode -->\r\n<!--- Provide a general summary of your changes in the Title above -->\r\n\r\n#### Bug/feature Description\r\nRunning pbs_probe on Ubuntu 16 fails becaue of a buffer overflow.\r\n\r\n#### Affected Platform(s)\r\n* Ubuntu 16\r\n\r\n#### Cause / Analysis / Design\r\nCall to `realpath()` in `get_realpath_value()` will put real path in array `real`, which was `MAXPATHLEN` long. On most systems this is defined to be 1024 which is not large enough. \r\n\r\n#### Solution Description\r\nA length of `PATH_MAX` (defined to be 4096 in `limits.h` on most linux systems) should be used instead.\r\n\r\n#### Testing logs/output\r\nNo new PTL test needed as test_pbs_probe in SmokeTest will be enough to cover this fix. \r\n* Ubuntu 16: [test_pbs_probe.txt](https://github.com/PBSPro/pbspro/files/2255121/test_pbs_probe.txt)\r\n* RHEL 7: [test_pbs_probe_r7.txt](https://github.com/PBSPro/pbspro/files/2291963/test_pbs_probe_r7.txt)\r\n* SLES 12: [test_pbs_probe_s12.txt](https://github.com/PBSPro/pbspro/files/2291964/test_pbs_probe_s12.txt)\r\n\r\n#### Checklist:\r\n<!--- Use the preview button to see the checkboxes/links properly. -->\r\n<!--- Go over the following points, and put an `x` (without spaces around it) in the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] I have joined the **[pbspro community forum](http://community.pbspro.org/)**.\r\n- [x] My pull request contains a **single, signed** commit. See **[setting up gpg signature](https://pbspro.atlassian.net/wiki/display/DG/Signing+Your+Git+Commits)**.\r\n- [x] My code follows the **[coding style](https://pbspro.atlassian.net/wiki/display/DG/Coding+Standards)** of this project.\r\n- [ ] My change requires project documentation. See **[required documentation checklist](https://pbspro.atlassian.net/wiki/display/DG/Checklist+for+Developing+Features+and+Bug+Fixes)** for details.\r\n   - [ ] I have added documentation in the **[project documentation area](https://pbspro.atlassian.net/wiki/display/PD)**.\r\n- [ ] I have added new **PTL test(s) to my commit**. (See **[using PTL for testing](https://pbspro.atlassian.net/wiki/display/DG/Using+PTL+for+Testing)**) *(or)*\r\n   - [ ] I have added  **manual test(s) to this pull request and explained why PTL is not appropriate** for this case.\r\n- [x] All new and existing automated tests have passed. (See **[running automated PTL tests](https://pbspro.atlassian.net/wiki/display/DG/PTL+Quick+Start+Guide)**).\r\n- [x] I have attached **test logs to this pull request** as evidence of testing/verification.\r\n\r\n\r\n__***For further information please visit the [Developer Guide Home](https://pbspro.atlassian.net/wiki/display/DG/Developer+Guide+Home).***__","created_at":"2018-07-24T18:08:49Z","updated_at":"2018-08-21T21:18:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75565bf607dd5714b5595a89586ecac50a12eedc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/PBSPro/pbspro/pulls/755/commits","review_comments_url":"https://api.github.com/repos/PBSPro/pbspro/pulls/755/comments","review_comment_url":"https://api.github.com/repos/PBSPro/pbspro/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PBSPro/pbspro/issues/755/comments","statuses_url":"https://api.github.com/repos/PBSPro/pbspro/statuses/b2bfd931fa831ba4d3608f544dd94337c3fbc0f1","head":{"label":"minghui-liu:pbsprobe_overflow","ref":"pbsprobe_overflow","sha":"b2bfd931fa831ba4d3608f544dd94337c3fbc0f1","user":{"login":"minghui-liu","id":6920446,"node_id":"MDQ6VXNlcjY5MjA0NDY=","avatar_url":"https://avatars1.githubusercontent.com/u/6920446?v=4","gravatar_id":"","url":"https://api.github.com/users/minghui-liu","html_url":"https://github.com/minghui-liu","followers_url":"https://api.github.com/users/minghui-liu/followers","following_url":"https://api.github.com/users/minghui-liu/following{/other_user}","gists_url":"https://api.github.com/users/minghui-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/minghui-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minghui-liu/subscriptions","organizations_url":"https://api.github.com/users/minghui-liu/orgs","repos_url":"https://api.github.com/users/minghui-liu/repos","events_url":"https://api.github.com/users/minghui-liu/events{/privacy}","received_events_url":"https://api.github.com/users/minghui-liu/received_events","type":"User","site_admin":false},"repo":{"id":85964356,"node_id":"MDEwOlJlcG9zaXRvcnk4NTk2NDM1Ng==","name":"pbspro","full_name":"minghui-liu/pbspro","owner":{"login":"minghui-liu","id":6920446,"node_id":"MDQ6VXNlcjY5MjA0NDY=","avatar_url":"https://avatars1.githubusercontent.com/u/6920446?v=4","gravatar_id":"","url":"https://api.github.com/users/minghui-liu","html_url":"https://github.com/minghui-liu","followers_url":"https://api.github.com/users/minghui-liu/followers","following_url":"https://api.github.com/users/minghui-liu/following{/other_user}","gists_url":"https://api.github.com/users/minghui-liu/gists{/gist_id}","starred_url":"https://api.github.com/users/minghui-liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minghui-liu/subscriptions","organizations_url":"https://api.github.com/users/minghui-liu/orgs","repos_url":"https://api.github.com/users/minghui-liu/repos","events_url":"https://api.github.com/users/minghui-liu/events{/privacy}","received_events_url":"https://api.github.com/users/minghui-liu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/minghui-liu/pbspro","description":"An HPC workload manager and job scheduler for desktops, clusters, and clouds.","fork":true,"url":"https://api.github.com/repos/minghui-liu/pbspro","forks_url":"https://api.github.com/repos/minghui-liu/pbspro/forks","keys_url":"https://api.github.com/repos/minghui-liu/pbspro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/minghui-liu/pbspro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/minghui-liu/pbspro/teams","hooks_url":"https://api.github.com/repos/minghui-liu/pbspro/hooks","issue_events_url":"https://api.github.com/repos/minghui-liu/pbspro/issues/events{/number}","events_url":"https://api.github.com/repos/minghui-liu/pbspro/events","assignees_url":"https://api.github.com/repos/minghui-liu/pbspro/assignees{/user}","branches_url":"https://api.github.com/repos/minghui-liu/pbspro/branches{/branch}","tags_url":"https://api.github.com/repos/minghui-liu/pbspro/tags","blobs_url":"https://api.github.com/repos/minghui-liu/pbspro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/minghui-liu/pbspro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/minghui-liu/pbspro/git/refs{/sha}","trees_url":"https://api.github.com/repos/minghui-liu/pbspro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/minghui-liu/pbspro/statuses/{sha}","languages_url":"https://api.github.com/repos/minghui-liu/pbspro/languages","stargazers_url":"https://api.github.com/repos/minghui-liu/pbspro/stargazers","contributors_url":"https://api.github.com/repos/minghui-liu/pbspro/contributors","subscribers_url":"https://api.github.com/repos/minghui-liu/pbspro/subscribers","subscription_url":"https://api.github.com/repos/minghui-liu/pbspro/subscription","commits_url":"https://api.github.com/repos/minghui-liu/pbspro/commits{/sha}","git_commits_url":"https://api.github.com/repos/minghui-liu/pbspro/git/commits{/sha}","comments_url":"https://api.github.com/repos/minghui-liu/pbspro/comments{/number}","issue_comment_url":"https://api.github.com/repos/minghui-liu/pbspro/issues/comments{/number}","contents_url":"https://api.github.com/repos/minghui-liu/pbspro/contents/{+path}","compare_url":"https://api.github.com/repos/minghui-liu/pbspro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/minghui-liu/pbspro/merges","archive_url":"https://api.github.com/repos/minghui-liu/pbspro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/minghui-liu/pbspro/downloads","issues_url":"https://api.github.com/repos/minghui-liu/pbspro/issues{/number}","pulls_url":"https://api.github.com/repos/minghui-liu/pbspro/pulls{/number}","milestones_url":"https://api.github.com/repos/minghui-liu/pbspro/milestones{/number}","notifications_url":"https://api.github.com/repos/minghui-liu/pbspro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/minghui-liu/pbspro/labels{/name}","releases_url":"https://api.github.com/repos/minghui-liu/pbspro/releases{/id}","deployments_url":"https://api.github.com/repos/minghui-liu/pbspro/deployments","created_at":"2017-03-23T15:14:22Z","updated_at":"2018-07-31T20:04:12Z","pushed_at":"2018-08-21T18:21:57Z","git_url":"git://github.com/minghui-liu/pbspro.git","ssh_url":"git@github.com:minghui-liu/pbspro.git","clone_url":"https://github.com/minghui-liu/pbspro.git","svn_url":"https://github.com/minghui-liu/pbspro","homepage":"www.pbspro.org","size":15917,"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":"PBSPro:master","ref":"master","sha":"882f33a732d82736aca098d8ee0a7e493287628c","user":{"login":"PBSPro","id":19280436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjgwNDM2","avatar_url":"https://avatars2.githubusercontent.com/u/19280436?v=4","gravatar_id":"","url":"https://api.github.com/users/PBSPro","html_url":"https://github.com/PBSPro","followers_url":"https://api.github.com/users/PBSPro/followers","following_url":"https://api.github.com/users/PBSPro/following{/other_user}","gists_url":"https://api.github.com/users/PBSPro/gists{/gist_id}","starred_url":"https://api.github.com/users/PBSPro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PBSPro/subscriptions","organizations_url":"https://api.github.com/users/PBSPro/orgs","repos_url":"https://api.github.com/users/PBSPro/repos","events_url":"https://api.github.com/users/PBSPro/events{/privacy}","received_events_url":"https://api.github.com/users/PBSPro/received_events","type":"Organization","site_admin":false},"repo":{"id":59082072,"node_id":"MDEwOlJlcG9zaXRvcnk1OTA4MjA3Mg==","name":"pbspro","full_name":"PBSPro/pbspro","owner":{"login":"PBSPro","id":19280436,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjgwNDM2","avatar_url":"https://avatars2.githubusercontent.com/u/19280436?v=4","gravatar_id":"","url":"https://api.github.com/users/PBSPro","html_url":"https://github.com/PBSPro","followers_url":"https://api.github.com/users/PBSPro/followers","following_url":"https://api.github.com/users/PBSPro/following{/other_user}","gists_url":"https://api.github.com/users/PBSPro/gists{/gist_id}","starred_url":"https://api.github.com/users/PBSPro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PBSPro/subscriptions","organizations_url":"https://api.github.com/users/PBSPro/orgs","repos_url":"https://api.github.com/users/PBSPro/repos","events_url":"https://api.github.com/users/PBSPro/events{/privacy}","received_events_url":"https://api.github.com/users/PBSPro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PBSPro/pbspro","description":"An HPC workload manager and job scheduler for desktops, clusters, and clouds.","fork":false,"url":"https://api.github.com/repos/PBSPro/pbspro","forks_url":"https://api.github.com/repos/PBSPro/pbspro/forks","keys_url":"https://api.github.com/repos/PBSPro/pbspro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PBSPro/pbspro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PBSPro/pbspro/teams","hooks_url":"https://api.github.com/repos/PBSPro/pbspro/hooks","issue_events_url":"https://api.github.com/repos/PBSPro/pbspro/issues/events{/number}","events_url":"https://api.github.com/repos/PBSPro/pbspro/events","assignees_url":"https://api.github.com/repos/PBSPro/pbspro/assignees{/user}","branches_url":"https://api.github.com/repos/PBSPro/pbspro/branches{/branch}","tags_url":"https://api.github.com/repos/PBSPro/pbspro/tags","blobs_url":"https://api.github.com/repos/PBSPro/pbspro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PBSPro/pbspro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PBSPro/pbspro/git/refs{/sha}","trees_url":"https://api.github.com/repos/PBSPro/pbspro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PBSPro/pbspro/statuses/{sha}","languages_url":"https://api.github.com/repos/PBSPro/pbspro/languages","stargazers_url":"https://api.github.com/repos/PBSPro/pbspro/stargazers","contributors_url":"https://api.github.com/repos/PBSPro/pbspro/contributors","subscribers_url":"https://api.github.com/repos/PBSPro/pbspro/subscribers","subscription_url":"https://api.github.com/repos/PBSPro/pbspro/subscription","commits_url":"https://api.github.com/repos/PBSPro/pbspro/commits{/sha}","git_commits_url":"https://api.github.com/repos/PBSPro/pbspro/git/commits{/sha}","comments_url":"https://api.github.com/repos/PBSPro/pbspro/comments{/number}","issue_comment_url":"https://api.github.com/repos/PBSPro/pbspro/issues/comments{/number}","contents_url":"https://api.github.com/repos/PBSPro/pbspro/contents/{+path}","compare_url":"https://api.github.com/repos/PBSPro/pbspro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PBSPro/pbspro/merges","archive_url":"https://api.github.com/repos/PBSPro/pbspro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PBSPro/pbspro/downloads","issues_url":"https://api.github.com/repos/PBSPro/pbspro/issues{/number}","pulls_url":"https://api.github.com/repos/PBSPro/pbspro/pulls{/number}","milestones_url":"https://api.github.com/repos/PBSPro/pbspro/milestones{/number}","notifications_url":"https://api.github.com/repos/PBSPro/pbspro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PBSPro/pbspro/labels{/name}","releases_url":"https://api.github.com/repos/PBSPro/pbspro/releases{/id}","deployments_url":"https://api.github.com/repos/PBSPro/pbspro/deployments","created_at":"2016-05-18T04:31:29Z","updated_at":"2018-08-20T21:56:38Z","pushed_at":"2018-08-21T18:21:59Z","git_url":"git://github.com/PBSPro/pbspro.git","ssh_url":"git@github.com:PBSPro/pbspro.git","clone_url":"https://github.com/PBSPro/pbspro.git","svn_url":"https://github.com/PBSPro/pbspro","homepage":"www.pbspro.org","size":15749,"stargazers_count":189,"watchers_count":189,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":148,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":148,"open_issues":20,"watchers":189,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/755"},"html":{"href":"https://github.com/PBSPro/pbspro/pull/755"},"issue":{"href":"https://api.github.com/repos/PBSPro/pbspro/issues/755"},"comments":{"href":"https://api.github.com/repos/PBSPro/pbspro/issues/755/comments"},"review_comments":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/755/comments"},"review_comment":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/755/commits"},"statuses":{"href":"https://api.github.com/repos/PBSPro/pbspro/statuses/b2bfd931fa831ba4d3608f544dd94337c3fbc0f1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mike0042"}}