GitHub PullRequestReviewCommentEvent at 2014-01-30 14:01:47
Repository: core
Actor: tzz
Payload: {"comment":{"url":"https://api.github.com/repos/cfengine/core/pulls/comments/9305620","id":9305620,"diff_hunk":"@@ -6427,21 +6421,37 @@ void ModuleProtocol(EvalContext *ctx, char *command, const char *line, int print\n         break;\n \n     case '+':\n-        Log(LOG_LEVEL_VERBOSE, \"Activated classes '%s'\", line + 1);\n-        if (CheckID(line + 1))\n+        if (strlen(line) > CF_MAXVARSIZE - 80)\n+        {\n+            Log(LOG_LEVEL_ERR, \"Module protocol was given an overlong +class line (%ld bytes), skipping\", strlen(line)-1);\n+            break;\n+        }\n+\n+        content[0] = '\\0';\n+        sscanf(line + 1, \"%1000[^\\n]\", content);\n+        Log(LOG_LEVEL_VERBOSE, \"Activating classes from module protocol: '%s'\", content);\n+        if (CheckID(content))\n         {\n             Buffer *tagbuf = StringSetToBuffer(*tags, ',');\n-            EvalContextClassPutSoft(ctx, line + 1, CONTEXT_SCOPE_NAMESPACE, BufferData(tagbuf));\n+            EvalContextClassPutSoft(ctx, content, CONTEXT_SCOPE_NAMESPACE, BufferData(tagbuf));\n             BufferDestroy(tagbuf);\n         }\n         break;\n     case '-':\n-        Log(LOG_LEVEL_VERBOSE, \"Deactivated classes '%s'\", line + 1);\n-        if (CheckID(line + 1))\n+        if (strlen(line) > CF_MAXVARSIZE - 80)","path":"libpromises/evalfunction.c","position":48,"original_position":48,"commit_id":"7f2d409093406737ddc3c82ee6fe268b9ab0a684","original_commit_id":"7f2d409093406737ddc3c82ee6fe268b9ab0a684","user":{"login":"tzz","id":67764,"avatar_url":"https://gravatar.com/avatar/86de95fb8c266dd8215050342369c89f?d=https%3A%2F%2Fidenticons.github.com%2F291601c53aba7bb60954f1841e083edb.png&r=x","gravatar_id":"86de95fb8c266dd8215050342369c89f","url":"https://api.github.com/users/tzz","html_url":"https://github.com/tzz","followers_url":"https://api.github.com/users/tzz/followers","following_url":"https://api.github.com/users/tzz/following{/other_user}","gists_url":"https://api.github.com/users/tzz/gists{/gist_id}","starred_url":"https://api.github.com/users/tzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tzz/subscriptions","organizations_url":"https://api.github.com/users/tzz/orgs","repos_url":"https://api.github.com/users/tzz/repos","events_url":"https://api.github.com/users/tzz/events{/privacy}","received_events_url":"https://api.github.com/users/tzz/received_events","type":"User","site_admin":false},"body":"Yup, copy+paste stupidity.  The original module protocol safeguard was `BUFSIZE-80`.  Fixed.","created_at":"2014-01-30T14:01:47Z","updated_at":"2014-01-30T14:01:47Z","html_url":"https://github.com/cfengine/core/pull/1366#discussion_r9305620","pull_request_url":"https://api.github.com/repos/cfengine/core/pulls/1366","_links":{"self":{"href":"https://api.github.com/repos/cfengine/core/pulls/comments/9305620"},"html":{"href":"https://github.com/cfengine/core/pull/1366#discussion_r9305620"},"pull_request":{"href":"https://api.github.com/repos/cfengine/core/pulls/1366"}}}}