>>707 自己レス
C99 から戻り値が完全な長さを答えてくれるみたい
なので len = snprintf(buf, 0, .... ); len+1 以上確保して snprintf(buf, len+1, .... );
これが出来るのか