jmuehlner commented on code in PR #470: URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437879365
########## src/libguac/string.c: ########## @@ -44,6 +45,22 @@ */ #define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length))) +size_t guac_itoa(char* restrict dest, int integer) { + + /* Make sure memory is cleared. */ + guac_mem_free(dest); Review Comment: I don't think it's unreasonable to expect the caller to have to allocate enough space - that's pretty normal. Especially for an integer value - the maximum possible length of string isn't that long. If you do want to have this allocate space itself, consider having the length of the string passed in as a pointer the way that `dest` currently is, and having it return the newly allocated string. That way there won't be any chance of somebody passing something un-freeable into the function. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@guacamole.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org