zsh-workers
 help / color / mirror / code / Atom feed
From: Orlov Sergey <orlov.home@gmail.com>
To: zsh-workers@zsh.org
Subject: PATCH: Fix seg fault on user autocomplete under msys
Date: Tue, 4 Apr 2017 22:43:47 +0300	[thread overview]
Message-ID: <CAKa5ew=YBSnWnisfkP9+RJx5RYTh_0f+cTNCQsKsf34_rUSvFg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

 Under windows (MSYS2 or Cygwin) user names can contain local characters.
For example user name "СИСТЕМА" (RU_ru.utf-8). This leads to infinite loop
in function quotestring and char array overflow.
So user names need metafy.

diff --git a/Src/utils.c b/Src/utils.c index b3fa3d24c..0aeb85089 100644
--- a/Src/utils.c +++ b/Src/utils.c @@ -1230,13 +1230,13 @@ adduserdir(char
*s, char *t, int flags, int always) * named directory, since these are
sometimes used for * special purposes. */ - nd->dir = ztrdup(t); + nd->dir
= metafy(t, -1, META_DUP); } else - nd->dir = ztrduppfx(t, eptr - t); +
nd->dir = metafy(t, eptr - t , META_DUP); /* The variables PWD and OLDPWD
are not to be displayed as ~PWD etc. */ if (!strcmp(s, "PWD") || !strcmp(s,
"OLDPWD")) nd->node.flags |= ND_NOABBREV; -
nameddirtab->addnode(nameddirtab, ztrdup(s), nd); +
nameddirtab->addnode(nameddirtab, metafy(s, -1, META_DUP), nd); } /* Get a
named directory: this function can cause a directory name *

                 reply	other threads:[~2017-04-04 19:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKa5ew=YBSnWnisfkP9+RJx5RYTh_0f+cTNCQsKsf34_rUSvFg@mail.gmail.com' \
    --to=orlov.home@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).