Commit 371988e1 371988e18011f4fb7f84b0d609a7a4333effefeb by Wojciech Polak

(expand_aliases): Bugfix. Do not use statically allocated buffer. Use header_age…

…t_field_name() instead.
The utility freezed with header names longer than 16 bytes.
1 parent a19877b1
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2003 Free Software Foundation, Inc. 2 Copyright (C) 2003, 2005 Free Software Foundation, Inc.
3 3
4 GNU Mailutils is free software; you can redistribute it and/or modify 4 GNU Mailutils is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -364,7 +364,7 @@ expand_aliases (message_t msg) ...@@ -364,7 +364,7 @@ expand_aliases (message_t msg)
364 { 364 {
365 header_t hdr; 365 header_t hdr;
366 size_t i, num; 366 size_t i, num;
367 char buf[16]; 367 char *buf;
368 address_t addr_to = NULL, 368 address_t addr_to = NULL,
369 addr_cc = NULL, 369 addr_cc = NULL,
370 addr_bcc = NULL; 370 addr_bcc = NULL;
...@@ -373,7 +373,8 @@ expand_aliases (message_t msg) ...@@ -373,7 +373,8 @@ expand_aliases (message_t msg)
373 header_get_field_count (hdr, &num); 373 header_get_field_count (hdr, &num);
374 for (i = 1; i <= num; i++) 374 for (i = 1; i <= num; i++)
375 { 375 {
376 header_get_field_name (hdr, i, buf, sizeof buf, NULL); 376 if (header_aget_field_name (hdr, i, &buf) == 0)
377 {
377 if (strcasecmp (buf, MU_HEADER_TO) == 0 378 if (strcasecmp (buf, MU_HEADER_TO) == 0
378 || strcasecmp (buf, MU_HEADER_CC) == 0 379 || strcasecmp (buf, MU_HEADER_CC) == 0
379 || strcasecmp (buf, MU_HEADER_BCC) == 0) 380 || strcasecmp (buf, MU_HEADER_BCC) == 0)
...@@ -393,6 +394,8 @@ expand_aliases (message_t msg) ...@@ -393,6 +394,8 @@ expand_aliases (message_t msg)
393 else if (strcasecmp (buf, MU_HEADER_BCC) == 0) 394 else if (strcasecmp (buf, MU_HEADER_BCC) == 0)
394 address_union (&addr_bcc, addr); 395 address_union (&addr_bcc, addr);
395 } 396 }
397 free (buf);
398 }
396 } 399 }
397 400
398 if (addr_to) 401 if (addr_to)
......