PR/58136: Paul Ripke: Fix use after free.

This commit is contained in:
christos 2024-04-13 02:01:38 +00:00
parent 30112b560c
commit 28614955c7
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: gettext.c,v 1.31 2019/10/03 16:35:57 christos Exp $ */ /* $NetBSD: gettext.c,v 1.32 2024/04/13 02:01:38 christos Exp $ */
/*- /*-
* Copyright (c) 2000, 2001 Citrus Project, * Copyright (c) 2000, 2001 Citrus Project,
@ -29,7 +29,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__RCSID("$NetBSD: gettext.c,v 1.31 2019/10/03 16:35:57 christos Exp $"); __RCSID("$NetBSD: gettext.c,v 1.32 2024/04/13 02:01:38 christos Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -176,6 +176,9 @@ pgettext_impl(const char *domainname, const char *msgctxt, const char *msgid1,
msgid2, n, category); msgid2, n, category);
free(msgctxt_id); free(msgctxt_id);
if (translation == msgctxt_id)
return msgid1;
p = strchr(translation, '\004'); p = strchr(translation, '\004');
if (p) if (p)
return p + 1; return p + 1;