{"action":"created","comment":{"url":"https://api.github.com/repos/neovim/neovim/pulls/comments/40540621","id":40540621,"diff_hunk":"@@ -370,6 +370,34 @@ size_t xstrlcpy(char *restrict dst, const char *restrict src, size_t size)\n     return ret;\n }\n \n+/// xstrlcat - appends string src to the end of dst.\n+///\n+/// Compatible with *BSD strlcat: It will append at most\n+/// dstsize - strlen(dst) - 1 characters.\n+/// It will then NUL-terminate, unless dstsize is 0 or\n+/// the original dst string was longer than dstsize\n+/// (in practice this should not happen as it means\n+/// that either dstsize is incorrect or that dst is not a proper string).\n+///\n+/// @param dst Where to copy the string to\n+/// @param src Where to copy the string from\n+/// @param size Size of destination buffer\n+/// @return the initial length of dst plus the length of src.\n+///         (i.e. strlen(src) + strlen(dst))\n+size_t xstrlcat(char *restrict dst, const char *restrict src, size_t dstsize)\n+  FUNC_ATTR_NONNULL_ALL\n+{\n+    size_t src_len = strlen(src);\n+    size_t dst_len = strlen(dst);\n+    size_t ret = src_len + dst_len;\n+    if (src_len) {\n+        size_t len = (ret >= dstsize) ? dstsize - 1 : ret;\n+        memcpy(dst + dst_len, src, len - dst_len);\n+        dst[len] = '\\0';\n+    }\n+    return src_len + dst_len;","path":"src/nvim/memory.c","position":null,"original_position":29,"commit_id":"211726ee7ce4694af5cf5a35f9a466e0742a2ab7","original_commit_id":"d46bb7ab2dcb1f6ecf970e03a4f8b4d40229a01c","user":{"login":"cztchoice","id":1571034,"avatar_url":"https://avatars.githubusercontent.com/u/1571034?v=3","gravatar_id":"","url":"https://api.github.com/users/cztchoice","html_url":"https://github.com/cztchoice","followers_url":"https://api.github.com/users/cztchoice/followers","following_url":"https://api.github.com/users/cztchoice/following{/other_user}","gists_url":"https://api.github.com/users/cztchoice/gists{/gist_id}","starred_url":"https://api.github.com/users/cztchoice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cztchoice/subscriptions","organizations_url":"https://api.github.com/users/cztchoice/orgs","repos_url":"https://api.github.com/users/cztchoice/repos","events_url":"https://api.github.com/users/cztchoice/events{/privacy}","received_events_url":"https://api.github.com/users/cztchoice/received_events","type":"User","site_admin":false},"body":"Thanks!","created_at":"2015-09-28T11:09:23Z","updated_at":"2015-09-28T11:09:23Z","html_url":"https://github.com/neovim/neovim/pull/3042#discussion_r40540621","pull_request_url":"https://api.github.com/repos/neovim/neovim/pulls/3042","_links":{"self":{"href":"https://api.github.com/repos/neovim/neovim/pulls/comments/40540621"},"html":{"href":"https://github.com/neovim/neovim/pull/3042#discussion_r40540621"},"pull_request":{"href":"https://api.github.com/repos/neovim/neovim/pulls/3042"}}},"pull_request":{"url":"https://api.github.com/repos/neovim/neovim/pulls/3042","id":40289834,"html_url":"https://github.com/neovim/neovim/pull/3042","diff_url":"https://github.com/neovim/neovim/pull/3042.diff","patch_url":"https://github.com/neovim/neovim/pull/3042.patch","issue_url":"https://api.github.com/repos/neovim/neovim/issues/3042","number":3042,"state":"open","locked":false,"title":"[RFC] Continue #1069 and add xstrlcat function","user":{"login":"cztchoice","id":1571034,"avatar_url":"https://avatars.githubusercontent.com/u/1571034?v=3","gravatar_id":"","url":"https://api.github.com/users/cztchoice","html_url":"https://github.com/cztchoice","followers_url":"https://api.github.com/users/cztchoice/followers","following_url":"https://api.github.com/users/cztchoice/following{/other_user}","gists_url":"https://api.github.com/users/cztchoice/gists{/gist_id}","starred_url":"https://api.github.com/users/cztchoice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cztchoice/subscriptions","organizations_url":"https://api.github.com/users/cztchoice/orgs","repos_url":"https://api.github.com/users/cztchoice/repos","events_url":"https://api.github.com/users/cztchoice/events{/privacy}","received_events_url":"https://api.github.com/users/cztchoice/received_events","type":"User","site_admin":false},"body":"Fix coverity issue in #988\r\nby using STRLCPY and add STRLCAT.\r\n\r\ncoverity related/{71530,71531,71532}\r\n\r\nProblems list there:\r\n> If strlen(dirname) >= MAXPATHL then NameBuff would not be NUL terminated. But the next function call could be using strlen on NameBuff. We should better use STRLCPY here. by @oni-link \r\n\r\ndone\r\n\r\n> STRNCAT uses MAXPATHL on the src argument, not on the dst argument. So appending \"**\" could overflow NameBuff, because no size check was made for dst. by @oni-link\r\n\r\nDone by add xstrlcat in memory.c, and check it.\r\n\r\n> check when truncation happens & EMSG(e_pathtoolong) by @splinterofchaos  @philix \r\n\r\ndone. Changes in option.c is not the same as ex_cmds.c haven't been discussed, so I don't check if truncation happens there.\r\n\r\n> rename the commit to ' coverity/{71530,71531,71532}: ...`  by @elmart\r\n\r\nShould I still do it now?","created_at":"2015-07-18T09:38:21Z","updated_at":"2015-09-28T11:09:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2a9ff11ce909e4774cbc5a0b814e2c1124e7ea13","assignee":null,"milestone":{"url":"https://api.github.com/repos/neovim/neovim/milestones/5","html_url":"https://github.com/neovim/neovim/milestones/0.1-first-public-release","labels_url":"https://api.github.com/repos/neovim/neovim/milestones/5/labels","id":652241,"number":5,"title":"0.1-first-public-release","description":"beta release, codename: \"whoa\"","creator":{"login":"justinmk","id":1359421,"avatar_url":"https://avatars.githubusercontent.com/u/1359421?v=3","gravatar_id":"","url":"https://api.github.com/users/justinmk","html_url":"https://github.com/justinmk","followers_url":"https://api.github.com/users/justinmk/followers","following_url":"https://api.github.com/users/justinmk/following{/other_user}","gists_url":"https://api.github.com/users/justinmk/gists{/gist_id}","starred_url":"https://api.github.com/users/justinmk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinmk/subscriptions","organizations_url":"https://api.github.com/users/justinmk/orgs","repos_url":"https://api.github.com/users/justinmk/repos","events_url":"https://api.github.com/users/justinmk/events{/privacy}","received_events_url":"https://api.github.com/users/justinmk/received_events","type":"User","site_admin":false},"open_issues":43,"closed_issues":98,"state":"open","created_at":"2014-05-07T21:37:18Z","updated_at":"2015-09-28T09:15:11Z","due_on":"2015-10-31T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/neovim/neovim/pulls/3042/commits","review_comments_url":"https://api.github.com/repos/neovim/neovim/pulls/3042/comments","review_comment_url":"https://api.github.com/repos/neovim/neovim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neovim/neovim/issues/3042/comments","statuses_url":"https://api.github.com/repos/neovim/neovim/statuses/211726ee7ce4694af5cf5a35f9a466e0742a2ab7","head":{"label":"cztchoice:fix-1069","ref":"fix-1069","sha":"211726ee7ce4694af5cf5a35f9a466e0742a2ab7","user":{"login":"cztchoice","id":1571034,"avatar_url":"https://avatars.githubusercontent.com/u/1571034?v=3","gravatar_id":"","url":"https://api.github.com/users/cztchoice","html_url":"https://github.com/cztchoice","followers_url":"https://api.github.com/users/cztchoice/followers","following_url":"https://api.github.com/users/cztchoice/following{/other_user}","gists_url":"https://api.github.com/users/cztchoice/gists{/gist_id}","starred_url":"https://api.github.com/users/cztchoice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cztchoice/subscriptions","organizations_url":"https://api.github.com/users/cztchoice/orgs","repos_url":"https://api.github.com/users/cztchoice/repos","events_url":"https://api.github.com/users/cztchoice/events{/privacy}","received_events_url":"https://api.github.com/users/cztchoice/received_events","type":"User","site_admin":false},"repo":{"id":38944465,"name":"neovim","full_name":"cztchoice/neovim","owner":{"login":"cztchoice","id":1571034,"avatar_url":"https://avatars.githubusercontent.com/u/1571034?v=3","gravatar_id":"","url":"https://api.github.com/users/cztchoice","html_url":"https://github.com/cztchoice","followers_url":"https://api.github.com/users/cztchoice/followers","following_url":"https://api.github.com/users/cztchoice/following{/other_user}","gists_url":"https://api.github.com/users/cztchoice/gists{/gist_id}","starred_url":"https://api.github.com/users/cztchoice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cztchoice/subscriptions","organizations_url":"https://api.github.com/users/cztchoice/orgs","repos_url":"https://api.github.com/users/cztchoice/repos","events_url":"https://api.github.com/users/cztchoice/events{/privacy}","received_events_url":"https://api.github.com/users/cztchoice/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cztchoice/neovim","description":"ambitious Vim-fork focused on extensibility and agility. Consider helping sustain Neovim development! ","fork":true,"url":"https://api.github.com/repos/cztchoice/neovim","forks_url":"https://api.github.com/repos/cztchoice/neovim/forks","keys_url":"https://api.github.com/repos/cztchoice/neovim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cztchoice/neovim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cztchoice/neovim/teams","hooks_url":"https://api.github.com/repos/cztchoice/neovim/hooks","issue_events_url":"https://api.github.com/repos/cztchoice/neovim/issues/events{/number}","events_url":"https://api.github.com/repos/cztchoice/neovim/events","assignees_url":"https://api.github.com/repos/cztchoice/neovim/assignees{/user}","branches_url":"https://api.github.com/repos/cztchoice/neovim/branches{/branch}","tags_url":"https://api.github.com/repos/cztchoice/neovim/tags","blobs_url":"https://api.github.com/repos/cztchoice/neovim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cztchoice/neovim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cztchoice/neovim/git/refs{/sha}","trees_url":"https://api.github.com/repos/cztchoice/neovim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cztchoice/neovim/statuses/{sha}","languages_url":"https://api.github.com/repos/cztchoice/neovim/languages","stargazers_url":"https://api.github.com/repos/cztchoice/neovim/stargazers","contributors_url":"https://api.github.com/repos/cztchoice/neovim/contributors","subscribers_url":"https://api.github.com/repos/cztchoice/neovim/subscribers","subscription_url":"https://api.github.com/repos/cztchoice/neovim/subscription","commits_url":"https://api.github.com/repos/cztchoice/neovim/commits{/sha}","git_commits_url":"https://api.github.com/repos/cztchoice/neovim/git/commits{/sha}","comments_url":"https://api.github.com/repos/cztchoice/neovim/comments{/number}","issue_comment_url":"https://api.github.com/repos/cztchoice/neovim/issues/comments{/number}","contents_url":"https://api.github.com/repos/cztchoice/neovim/contents/{+path}","compare_url":"https://api.github.com/repos/cztchoice/neovim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cztchoice/neovim/merges","archive_url":"https://api.github.com/repos/cztchoice/neovim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cztchoice/neovim/downloads","issues_url":"https://api.github.com/repos/cztchoice/neovim/issues{/number}","pulls_url":"https://api.github.com/repos/cztchoice/neovim/pulls{/number}","milestones_url":"https://api.github.com/repos/cztchoice/neovim/milestones{/number}","notifications_url":"https://api.github.com/repos/cztchoice/neovim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cztchoice/neovim/labels{/name}","releases_url":"https://api.github.com/repos/cztchoice/neovim/releases{/id}","created_at":"2015-07-12T00:00:04Z","updated_at":"2015-07-12T00:00:09Z","pushed_at":"2015-09-28T11:09:02Z","git_url":"git://github.com/cztchoice/neovim.git","ssh_url":"git@github.com:cztchoice/neovim.git","clone_url":"https://github.com/cztchoice/neovim.git","svn_url":"https://github.com/cztchoice/neovim","homepage":"https://salt.bountysource.com/teams/neovim","size":33647,"stargazers_count":0,"watchers_count":0,"language":"VimL","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"neovim:master","ref":"master","sha":"622ec95c3f793a814b3e7c0ee697c959f5b77332","user":{"login":"neovim","id":6471485,"avatar_url":"https://avatars.githubusercontent.com/u/6471485?v=3","gravatar_id":"","url":"https://api.github.com/users/neovim","html_url":"https://github.com/neovim","followers_url":"https://api.github.com/users/neovim/followers","following_url":"https://api.github.com/users/neovim/following{/other_user}","gists_url":"https://api.github.com/users/neovim/gists{/gist_id}","starred_url":"https://api.github.com/users/neovim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neovim/subscriptions","organizations_url":"https://api.github.com/users/neovim/orgs","repos_url":"https://api.github.com/users/neovim/repos","events_url":"https://api.github.com/users/neovim/events{/privacy}","received_events_url":"https://api.github.com/users/neovim/received_events","type":"Organization","site_admin":false},"repo":{"id":16408992,"name":"neovim","full_name":"neovim/neovim","owner":{"login":"neovim","id":6471485,"avatar_url":"https://avatars.githubusercontent.com/u/6471485?v=3","gravatar_id":"","url":"https://api.github.com/users/neovim","html_url":"https://github.com/neovim","followers_url":"https://api.github.com/users/neovim/followers","following_url":"https://api.github.com/users/neovim/following{/other_user}","gists_url":"https://api.github.com/users/neovim/gists{/gist_id}","starred_url":"https://api.github.com/users/neovim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neovim/subscriptions","organizations_url":"https://api.github.com/users/neovim/orgs","repos_url":"https://api.github.com/users/neovim/repos","events_url":"https://api.github.com/users/neovim/events{/privacy}","received_events_url":"https://api.github.com/users/neovim/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neovim/neovim","description":"Vim-fork focused on extensibility and agility. Consider helping sustain Neovim development! ","fork":false,"url":"https://api.github.com/repos/neovim/neovim","forks_url":"https://api.github.com/repos/neovim/neovim/forks","keys_url":"https://api.github.com/repos/neovim/neovim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neovim/neovim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neovim/neovim/teams","hooks_url":"https://api.github.com/repos/neovim/neovim/hooks","issue_events_url":"https://api.github.com/repos/neovim/neovim/issues/events{/number}","events_url":"https://api.github.com/repos/neovim/neovim/events","assignees_url":"https://api.github.com/repos/neovim/neovim/assignees{/user}","branches_url":"https://api.github.com/repos/neovim/neovim/branches{/branch}","tags_url":"https://api.github.com/repos/neovim/neovim/tags","blobs_url":"https://api.github.com/repos/neovim/neovim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neovim/neovim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neovim/neovim/git/refs{/sha}","trees_url":"https://api.github.com/repos/neovim/neovim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neovim/neovim/statuses/{sha}","languages_url":"https://api.github.com/repos/neovim/neovim/languages","stargazers_url":"https://api.github.com/repos/neovim/neovim/stargazers","contributors_url":"https://api.github.com/repos/neovim/neovim/contributors","subscribers_url":"https://api.github.com/repos/neovim/neovim/subscribers","subscription_url":"https://api.github.com/repos/neovim/neovim/subscription","commits_url":"https://api.github.com/repos/neovim/neovim/commits{/sha}","git_commits_url":"https://api.github.com/repos/neovim/neovim/git/commits{/sha}","comments_url":"https://api.github.com/repos/neovim/neovim/comments{/number}","issue_comment_url":"https://api.github.com/repos/neovim/neovim/issues/comments{/number}","contents_url":"https://api.github.com/repos/neovim/neovim/contents/{+path}","compare_url":"https://api.github.com/repos/neovim/neovim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neovim/neovim/merges","archive_url":"https://api.github.com/repos/neovim/neovim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neovim/neovim/downloads","issues_url":"https://api.github.com/repos/neovim/neovim/issues{/number}","pulls_url":"https://api.github.com/repos/neovim/neovim/pulls{/number}","milestones_url":"https://api.github.com/repos/neovim/neovim/milestones{/number}","notifications_url":"https://api.github.com/repos/neovim/neovim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neovim/neovim/labels{/name}","releases_url":"https://api.github.com/repos/neovim/neovim/releases{/id}","created_at":"2014-01-31T13:39:22Z","updated_at":"2015-09-28T10:50:40Z","pushed_at":"2015-09-28T11:09:03Z","git_url":"git://github.com/neovim/neovim.git","ssh_url":"git@github.com:neovim/neovim.git","clone_url":"https://github.com/neovim/neovim.git","svn_url":"https://github.com/neovim/neovim","homepage":"https://salt.bountysource.com/teams/neovim","size":80319,"stargazers_count":15142,"watchers_count":15142,"language":"VimL","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1041,"mirror_url":null,"open_issues_count":525,"forks":1041,"open_issues":525,"watchers":15142,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/neovim/neovim/pulls/3042"},"html":{"href":"https://github.com/neovim/neovim/pull/3042"},"issue":{"href":"https://api.github.com/repos/neovim/neovim/issues/3042"},"comments":{"href":"https://api.github.com/repos/neovim/neovim/issues/3042/comments"},"review_comments":{"href":"https://api.github.com/repos/neovim/neovim/pulls/3042/comments"},"review_comment":{"href":"https://api.github.com/repos/neovim/neovim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neovim/neovim/pulls/3042/commits"},"statuses":{"href":"https://api.github.com/repos/neovim/neovim/statuses/211726ee7ce4694af5cf5a35f9a466e0742a2ab7"}}}}