zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: fix home directory expansion with NIS
@ 2007-11-01 10:40 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2007-11-01 10:40 UTC (permalink / raw)
  To: Zsh workers

This has been irritating me for a while: some ~username expansions were
coming out as garbled strings from the middle of the password file.

The problem, which is specific to NIS on Solaris, occurs because our
yp_all callback was assuming that the key and val parameters are null
terminated. The fix below makes use of the vallen parameter to find the
end of the string.

Oliver

--- hashtable.c.orig	Thu Nov  1 10:59:22 2007
+++ hashtable.c	Thu Nov  1 11:00:34 2007
@@ -1258,7 +1258,8 @@
 
     if (vallen > keylen && *(p = val + keylen) == ':') {
 	*p++ = '\0';
-	if ((de = strrchr(p, ':'))) {
+	for (de = val + vallen - 1; *de != ':' && de > val; de--);
+	if (de > val) {
 	    *de = '\0';
 	    if ((d = strrchr(p, ':'))) {
 		if (*++d && val[0])


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-01 10:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-01 10:40 PATCH: fix home directory expansion with NIS Oliver Kiddle

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).