- /* TODO: Check for buffer length! */
- strcat(buffer, " ");
- strcat(buffer, m_name(msgnum));
- }
- strcat(buffer, "'");
- /* TODO: This check is bad, but better than nothing */
- if (strlen(buffer) > BUFSIZ) {
- adios(NULL, "Too long attachment header line. Forward less messages.");
+ if (strlen(buf) + 1 + strlen(m_name(msgnum)) + 1
+ > sizeof buf) {
+ adios(NULL, "Attachment header line too long. "
+ "Forward less messages.");
+ }
+ strcat(buf, " ");
+ strcat(buf, m_name(msgnum));