From f9647fd270a84e72656c01bc9c70481faecc13b1 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 21 Dec 2007 08:31:42 +0000 Subject: [PATCH] Ensure fname is 0-terminated in parse_cmd_doc for yaz-client. --- client/client.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/client.c b/client/client.c index cbb4870..671332e 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: client.c,v 1.353 2007-11-21 13:53:20 adam Exp $ + * $Id: client.c,v 1.354 2007-12-21 08:31:42 adam Exp $ */ /** \file client.c * \brief yaz-client program @@ -616,11 +616,14 @@ static int parse_cmd_doc(const char **arg, ODR out, char **buf, { long fsize; FILE *inf; - const char *fname = *arg; + const char *fname; + const char *arg_start = *arg; while (**arg != '\0' && **arg != ' ') (*arg)++; + fname = odr_strdupn(out, arg_start, *arg - arg_start); + inf = fopen(fname, "rb"); if (!inf) { -- 1.7.10.4