+2004-01-14 Bruno Haible <bruno@clisp.org>
+
+ * msginit.c (fill_header): Avoid a NULL pointer access when the header
+ has no comment attached to it.
+ Reported by Josep Puigdemont <baldrick@terra.es>.
+
2004-01-09 Bruno Haible <bruno@clisp.org>
* msgattrib.c (main): Update year in --version output.
{
message_ty *header_mp = NULL;
char *header;
- const char *subst[4][2];
- const char *id;
- time_t now;
/* Search the header entry. */
for (j = 0; j < mlp->nitems; j++)
header_mp->msgstr_len = strlen (header) + 1;
/* Update the comments in the header entry. */
- id = project_id ();
- subst[0][0] = "SOME DESCRIPTIVE TITLE";
- subst[0][1] = xasprintf (get_title (), id, id);
- subst[1][0] = "PACKAGE";
- subst[1][1] = id;
- subst[2][0] = "FIRST AUTHOR <EMAIL@ADDRESS>";
- subst[2][1] = field_value[FIELD_LAST_TRANSLATOR];
- subst[3][0] = "YEAR";
- subst[3][1] =
- xasprintf ("%d", (time (&now), (localtime (&now))->tm_year + 1900));
- subst_string_list (header_mp->comment, SIZEOF (subst), subst);
+ if (header_mp->comment != NULL)
+ {
+ const char *subst[4][2];
+ const char *id;
+ time_t now;
+
+ id = project_id ();
+ subst[0][0] = "SOME DESCRIPTIVE TITLE";
+ subst[0][1] = xasprintf (get_title (), id, id);
+ subst[1][0] = "PACKAGE";
+ subst[1][1] = id;
+ subst[2][0] = "FIRST AUTHOR <EMAIL@ADDRESS>";
+ subst[2][1] = field_value[FIELD_LAST_TRANSLATOR];
+ subst[3][0] = "YEAR";
+ subst[3][1] =
+ xasprintf ("%d",
+ (time (&now), (localtime (&now))->tm_year + 1900));
+ subst_string_list (header_mp->comment, SIZEOF (subst), subst);
+ }
/* Finally remove the fuzzy attribute. */
header_mp->is_fuzzy = false;