From 5f265b755a92e7efdbd0d18694913209dfd9e055 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 11 May 2001 16:58:46 +0000 Subject: Fix a segfault in lash, hush, and cmdedit. Each of these used xgetcwd, but did not check the return for a NULL, and then continued to call strlen on the NULL when the cwd had been removed from under it. -Erik --- shell/cmdedit.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'shell/cmdedit.c') diff --git a/shell/cmdedit.c b/shell/cmdedit.c index ce5450032..ec9939312 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c @@ -355,6 +355,10 @@ static void parse_prompt(const char *prmt_ptr) char c; char *pbuf; + if (!pwd_buf) { + pwd_buf=unknown; + } + while (*prmt_ptr) { pbuf = buf; pbuf[1] = 0; -- cgit v1.2.3