Subject: | [PATCH] Fix use of uninitialized memory |
Date: | Fri, 20 Jun 2014 17:15:16 +0200 |
To: | bug-Text-BibTeX [...] rt.cpan.org |
From: | Andreas Schwab <schwab [...] linux-m68k.org> |
Index: Text-BibTeX-0.66/btparse/src/format_name.c
===================================================================
--- Text-BibTeX-0.66.orig/btparse/src/format_name.c
+++ Text-BibTeX-0.66/btparse/src/format_name.c
@@ -120,6 +120,8 @@ bt_create_name_format (char * parts, boo
format = (bt_name_format *) malloc (sizeof (bt_name_format));
format->num_parts = num_parts;
+ for (i = 0; i < BT_MAX_NAMEPARTS; i++)
+ part_pos[i] = -2;
for (i = 0; i < num_parts; i++)
{
switch (parts[i])
@@ -994,6 +996,11 @@ dump_format (bt_name_format * format)
for (i = 0; i < BT_MAX_NAMEPARTS; i++)
{
+ int j;
+ for (j = 0; j < format->num_parts; j++)
+ if (i == format->parts[j])
+ break;
+ if (j == format->num_parts) continue;
printf (" %-5s: pre-part=%p (%s), post-part=%p (%s)\n",
nameparts[i],
format->pre_part[i], format->pre_part[i],
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."