{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"user":{"avatar_url":"https://secure.gravatar.com/avatar/48b95af4d9e286f3baf107f8188dd186?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"48b95af4d9e286f3baf107f8188dd186","url":"https://api.github.com/users/erjiang","login":"erjiang","id":321497},"milestone":null,"labels":[],"updated_at":"2011-11-06T05:00:02Z","assignee":null,"comments":1,"closed_at":null,"url":"https://api.github.com/repos/flagcapper/GoogleAI-Ants-Starter-Pack/issues/2","body":"At MyBot.c:109\r\n\r\n        char *data = malloc(initial_buffer);\r\n        memset(data, 0, initial_buffer);\r\n\r\n        *data = '\\n';\r\n\r\n        char *ins_data = data + 1;\r\n\r\n        int i = 0;\r\n\r\n        while (1 > 0) {\r\n            ++i;\r\n\r\n            if (i > initial_buffer) {\r\n                initial_buffer *= 2;\r\n                data = realloc(data, initial_buffer);\r\n                memset(ins_data, 0, initial_buffer/2);\r\n            }\r\n\r\n            *ins_data = getchar();\r\n\r\nYou realloc data but you never update `ins_data` to point to the new data! If it ever outgrows its initial buffer, it will probably keep writing memory it shouldn't be writing to. Also, since `data` is only realloc'd when i is strictly greater than `initial_buffer`, it will write past the end of the buffer by one byte.","html_url":"https://github.com/flagcapper/GoogleAI-Ants-Starter-Pack/issues/2","title":"Invalid memory writes","number":2,"id":2154840,"created_at":"2011-11-06T03:45:54Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/2e525c4771b1714e08b468445e262199?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"2e525c4771b1714e08b468445e262199","url":"https://api.github.com/users/flagcapper","login":"flagcapper","id":116877},"updated_at":"2011-11-06T05:00:02Z","url":"https://api.github.com/repos/flagcapper/GoogleAI-Ants-Starter-Pack/issues/comments/2644003","body":"Thanks for the heads up! This should be fixed now.","id":2644003,"created_at":"2011-11-06T05:00:02Z"}}