From: Adam Dickmeiss Date: Fri, 21 Dec 2007 08:31:42 +0000 (+0000) Subject: Ensure fname is 0-terminated in parse_cmd_doc for yaz-client. X-Git-Tag: YAZ.3.0.20~28 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=f9647fd270a84e72656c01bc9c70481faecc13b1 Ensure fname is 0-terminated in parse_cmd_doc for yaz-client. --- 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) {