summaryrefslogtreecommitdiff
path: root/lib/argp-help.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-01-05 17:00:53 +0100
committerBruno Haible <bruno@clisp.org>2019-01-05 17:00:53 +0100
commitff3fe55c7c95bdb9460a40747912b4b309519838 (patch)
treeb2511c719ba1873e9452008424612d21f9eff982 /lib/argp-help.c
parentd91fe44f159cfe7614d9e1547624579161bd25c5 (diff)
downloadgnulib-ff3fe55c7c95bdb9460a40747912b4b309519838.tar.gz
argp: Don't pass an invalid argument to dgettext().
Reported by He X <xw897002528@gmail.com>. * lib/argp.h (struct argp): Clarify that the args_doc field may be NULL. * lib/argp-help.c (argp_args_usage): Don't pass a NULL args_doc to dgettext().
Diffstat (limited to 'lib/argp-help.c')
-rw-r--r--lib/argp-help.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/argp-help.c b/lib/argp-help.c
index e5375a0f04..e5e97ecf6c 100644
--- a/lib/argp-help.c
+++ b/lib/argp-help.c
@@ -1412,8 +1412,10 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state,
char *our_level = *levels;
int multiple = 0;
const struct argp_child *child = argp->children;
- const char *tdoc = dgettext (argp->argp_domain, argp->args_doc), *nl = 0;
+ const char *tdoc =
+ argp->args_doc ? dgettext (argp->argp_domain, argp->args_doc) : NULL;
const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC, argp, state);
+ const char *nl = NULL;
if (fdoc)
{