Message ID | ZhkEHWODl9ZFKBhq@gondor.apana.org.au (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
Series | alias: Disallow non-CWORD characters | expand |
diff --git a/src/alias.c b/src/alias.c index cee07e9..3cd3413 100644 --- a/src/alias.c +++ b/src/alias.c @@ -41,6 +41,7 @@ #include "mystring.h" #include "alias.h" #include "options.h" /* XXX for argptr (should remove?) */ +#include "syntax.h" #define ATABSIZE 39 @@ -55,6 +56,11 @@ void setalias(const char *name, const char *val) { struct alias *ap, **app; + const char *p; + + for (p = name; *p; p++) + if (BASESYNTAX[(signed char)*p] != CWORD) + sh_error("Invalid alias name: %s", name); app = __lookupalias(name); ap = *app;