* PATCH: Prevent circular module aliases
@ 2005-08-08 23:08 Thorsten Dahlheimer
0 siblings, 0 replies; only message in thread
From: Thorsten Dahlheimer @ 2005-08-08 23:08 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 265 bytes --]
The check that zmodload -A performs to prevent the creation of circular
alias chains is not thorough enough:
% zmodload -A A=B B=C B=A
% zmodload -A
A -> B
B -> A
% zmodload A
<stack overflow>
I've fixed that.
Regards,
Thorsten Dahlheimer
[-- Attachment #2: zmodload2.patch --]
[-- Type: application/octet-stream, Size: 1000 bytes --]
Index: Src/module.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/module.c,v
retrieving revision 1.18
diff -u -p -r1.18 module.c
--- Src/module.c 20 Jul 2005 16:08:22 -0000 1.18
+++ Src/module.c 8 Aug 2005 22:38:26 -0000
@@ -1093,12 +1091,15 @@ bin_zmodload_alias(char *nam, char **arg
zwarnnam(nam, "invalid module name `%s'", aliasname, 0);
return 1;
}
- find_module(aliasname, 1, &mname);
- if (!strcmp(mname, *args)) {
- zwarnnam(nam, "module alias would refer to itself: %s",
- *args, 0);
- return 1;
- }
+ do {
+ if (!strcmp(mname, *args)) {
+ zwarnnam(nam, "module alias would refer to itself: %s",
+ *args, 0);
+ return 1;
+ }
+ } while ((node = find_module(mname, 0, NULL))
+ && ((m = (Module) getdata(node))->flags & MOD_ALIAS)
+ && (mname = m->u.alias));
node = find_module(*args, 0, NULL);
if (node) {
m = (Module) getdata(node);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-08-08 22:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-08 23:08 PATCH: Prevent circular module aliases Thorsten Dahlheimer
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).