{"action":"created","issue":{"url":"https://api.github.com/repos/eggheads/eggdrop/issues/714","repository_url":"https://api.github.com/repos/eggheads/eggdrop","labels_url":"https://api.github.com/repos/eggheads/eggdrop/issues/714/labels{/name}","comments_url":"https://api.github.com/repos/eggheads/eggdrop/issues/714/comments","events_url":"https://api.github.com/repos/eggheads/eggdrop/issues/714/events","html_url":"https://github.com/eggheads/eggdrop/pull/714","id":370487625,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzMTUxNzM0","number":714,"title":"Fix 2 Wformat-truncation (gcc 8.2.1 default cflags)","user":{"login":"michaelortmann","id":41313082,"node_id":"MDQ6VXNlcjQxMzEzMDgy","avatar_url":"https://avatars1.githubusercontent.com/u/41313082?v=4","gravatar_id":"","url":"https://api.github.com/users/michaelortmann","html_url":"https://github.com/michaelortmann","followers_url":"https://api.github.com/users/michaelortmann/followers","following_url":"https://api.github.com/users/michaelortmann/following{/other_user}","gists_url":"https://api.github.com/users/michaelortmann/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelortmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelortmann/subscriptions","organizations_url":"https://api.github.com/users/michaelortmann/orgs","repos_url":"https://api.github.com/users/michaelortmann/repos","events_url":"https://api.github.com/users/michaelortmann/events{/privacy}","received_events_url":"https://api.github.com/users/michaelortmann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/eggheads/eggdrop/milestones/12","html_url":"https://github.com/eggheads/eggdrop/milestone/12","labels_url":"https://api.github.com/repos/eggheads/eggdrop/milestones/12/labels","id":3537557,"node_id":"MDk6TWlsZXN0b25lMzUzNzU1Nw==","number":12,"title":"v1.8.4","description":"","creator":{"login":"Cizzle","id":709246,"node_id":"MDQ6VXNlcjcwOTI0Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/709246?v=4","gravatar_id":"","url":"https://api.github.com/users/Cizzle","html_url":"https://github.com/Cizzle","followers_url":"https://api.github.com/users/Cizzle/followers","following_url":"https://api.github.com/users/Cizzle/following{/other_user}","gists_url":"https://api.github.com/users/Cizzle/gists{/gist_id}","starred_url":"https://api.github.com/users/Cizzle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cizzle/subscriptions","organizations_url":"https://api.github.com/users/Cizzle/orgs","repos_url":"https://api.github.com/users/Cizzle/repos","events_url":"https://api.github.com/users/Cizzle/events{/privacy}","received_events_url":"https://api.github.com/users/Cizzle/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":128,"state":"open","created_at":"2018-07-31T21:37:03Z","updated_at":"2018-10-30T22:18:04Z","due_on":"2018-12-01T08:00:00Z","closed_at":null},"comments":2,"created_at":"2018-10-16T08:06:47Z","updated_at":"2018-10-30T22:18:20Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/eggheads/eggdrop/pulls/714","html_url":"https://github.com/eggheads/eggdrop/pull/714","diff_url":"https://github.com/eggheads/eggdrop/pull/714.diff","patch_url":"https://github.com/eggheads/eggdrop/pull/714.patch"},"body":"Found by: michaelortmann\r\nPatch by: michaelortmann\r\nFixes: \r\n\r\nOne-line summary:\r\nFix 2 Wformat-truncation (gcc 8.2.1 default cflags)\r\n\r\nAdditional description (if needed):\r\nResized a buffer to be undersized due to sane assumption that struct tm is sane (i mean, we already assumed tm->tm_min would be 0-59, we continue to do so) and at the same time oversized to silence a gcc format-truncation warning (i mean, gcc already seems to assume that struct tm is sane, but it looses its grip, when we do math, like tm->tm_year + 1900).\r\n\r\nWe could solve this in different ways, but i don't want to waste cpu cycles over it, so resetting the buffer size is it.\r\n\r\nWhile at it, combine 2 functions into 1. It safes some more cpu/bytes in mainloop/check_minutely. So to optimize here should be reasonable. IRC chat with thommey was fine about it.\r\n\r\n\r\nTest cases demonstrating functionality (if applicable):\r\n```\r\ngcc -g -O2 -pipe -Wall -I.. -I..  -DHAVE_CONFIG_H -I/usr/include -g3 -DDEBUG -DDEBUG_ASSERT -DDEBUG_MEM -DDEBUG_DNS  -c tclhash.c\r\ntclhash.c: In function ‘check_tcl_time’:\r\ntclhash.c:1199:50: warning: ‘%04d’ directive output may be truncated writing between 4 and 11 bytes into a region of size between 0 and 6 [-Wformat-truncation=]\r\n   egg_snprintf(y, sizeof y, \"%02d %02d %02d %02d %04d\", tm->tm_min, tm->tm_hour,\r\n                                                  ^~~~\r\ntclhash.c:1199:29: note: directive argument in the range [-2147481748, 2147483647]\r\n   egg_snprintf(y, sizeof y, \"%02d %02d %02d %02d %04d\", tm->tm_min, tm->tm_hour,\r\n                             ^~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from compat/compat.h:27,\r\n                 from main.h:102,\r\n                 from tclhash.c:31:\r\ncompat/snprintf.h:58:24: note: ‘snprintf’ output between 17 and 60 bytes into a destination of size 18\r\n #  define egg_snprintf snprintf\r\ntclhash.c:1199:3: note: in expansion of macro ‘egg_snprintf’\r\n   egg_snprintf(y, sizeof y, \"%02d %02d %02d %02d %04d\", tm->tm_min, tm->tm_hour,\r\n   ^~~~~~~~~~~~\r\ntclhash.c: In function ‘check_tcl_cron’:\r\ntclhash.c:1220:45: warning: ‘%02d’ directive output may be truncated writing between 2 and 11 bytes into a region of size between 0 and 6 [-Wformat-truncation=]\r\n   egg_snprintf(y, sizeof y, \"%02d %02d %02d %02d %02d\", tm->tm_min, tm->tm_hour,\r\n                                             ^~~~\r\ntclhash.c:1220:29: note: directive argument in the range [-2147483647, 2147483647]\r\n   egg_snprintf(y, sizeof y, \"%02d %02d %02d %02d %02d\", tm->tm_min, tm->tm_hour,\r\n                             ^~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from compat/compat.h:27,\r\n                 from main.h:102,\r\n                 from tclhash.c:31:\r\ncompat/snprintf.h:58:24: note: ‘snprintf’ output between 15 and 60 bytes into a destination of size 15\r\n #  define egg_snprintf snprintf\r\ntclhash.c:1220:3: note: in expansion of macro ‘egg_snprintf’\r\n   egg_snprintf(y, sizeof y, \"%02d %02d %02d %02d %02d\", tm->tm_min, tm->tm_hour,\r\n   ^~~~~~~~~~~~\r\n```"},"comment":{"url":"https://api.github.com/repos/eggheads/eggdrop/issues/comments/434490604","html_url":"https://github.com/eggheads/eggdrop/pull/714#issuecomment-434490604","issue_url":"https://api.github.com/repos/eggheads/eggdrop/issues/714","id":434490604,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDQ5MDYwNA==","user":{"login":"Cizzle","id":709246,"node_id":"MDQ6VXNlcjcwOTI0Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/709246?v=4","gravatar_id":"","url":"https://api.github.com/users/Cizzle","html_url":"https://github.com/Cizzle","followers_url":"https://api.github.com/users/Cizzle/followers","following_url":"https://api.github.com/users/Cizzle/following{/other_user}","gists_url":"https://api.github.com/users/Cizzle/gists{/gist_id}","starred_url":"https://api.github.com/users/Cizzle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cizzle/subscriptions","organizations_url":"https://api.github.com/users/Cizzle/orgs","repos_url":"https://api.github.com/users/Cizzle/repos","events_url":"https://api.github.com/users/Cizzle/events{/privacy}","received_events_url":"https://api.github.com/users/Cizzle/received_events","type":"User","site_admin":false},"created_at":"2018-10-30T22:18:20Z","updated_at":"2018-10-30T22:18:20Z","author_association":"MEMBER","body":"LGTM"}}
{"actor":{"display_login":"Cizzle"}}