- else if ((size_t)ival >= sizeof(tempbuf))
- {
- /*
- * String is too long, copy as much as possible.
- * It will be further truncated later.
- */
- memcpy(tempbuf, sval, sizeof(tempbuf)-1);
- tempbuf[sizeof(tempbuf)-1] = '\0';
- }
- else
- {
- memcpy(tempbuf, sval, (size_t) ival);
- tempbuf[ival] = '\0';
- }
+ /*
+ * XXX: In case of printable characters at the end of
+ * the %N string, we're not using the whole buffer.
+ */
+ format_string = (length < log_buffer_size - 6) ? "" : "[too long]";