7b4ce92677
and the number of bytes used on return. Use the actual buffer size in a snprintf call, instead of sizeof(*buf), which is always 1.