--- !ditz.rubyforge.org,2008-03-06/issue title: cleanup snprintf() convention desc: |- There seem to be to variants of snprintf (and its friends): some ensure a NUL terminator is added when truncated and others do not. The most portable way seems to be to:: char buf[256]; snprintf(buf, sizeof(buf), "format", args); buf[sizeof(buf) - 1] = (char) 0; Using sizeof(buf) - 1 for size may cause a NUL terminator to appear at the second to last character of buf in some cases. Document in code-issues.txt. type: :task component: duk release: v0.8 reporter: sva status: :closed disposition: :fixed creation_time: 2013-09-19 07:09:07.951148 Z references: [] id: ee19ffa04904f297e2ac4957a4cd442c9a0e0c2b log_events: - - 2013-09-19 07:09:08.132219 Z - sva - created - "" - - 2013-09-19 07:12:50.251175 Z - sva - commented - |- Also the return value of snprintf (and its friends) seems to vary between implementations when the string is truncated. This is mostly the case with old environments. Document that snprintf return value is not to be trusted without care. - - 2013-12-12 08:23:11.030120 Z - sva - changed status from unstarted to in_progress - "" - - 2013-12-12 20:37:57.789001 Z - sva - closed with disposition fixed - ""