From cb1f07352af92688983563998f9251ab20cac821 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sat, 21 Feb 2009 21:17:51 +0000 Subject: Reject invalid level specifications in /set. Most of these have names that end in "_level". git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5021 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/levels.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/core/levels.c') diff --git a/src/core/levels.c b/src/core/levels.c index 73743352..3cc00e95 100644 --- a/src/core/levels.c +++ b/src/core/levels.c @@ -81,11 +81,14 @@ int level_get(const char *level) return match; } -int level2bits(const char *level) +int level2bits(const char *level, int *errorp) { char *orig, *str, *ptr; int ret, singlelevel, negative; + if (errorp != NULL) + *errorp = FALSE; + g_return_val_if_fail(level != NULL, 0); if (*level == '\0') @@ -107,7 +110,8 @@ int level2bits(const char *level) if (singlelevel != 0) { ret = !negative ? (ret | singlelevel) : (ret & ~singlelevel); - } + } else if (errorp != NULL) + *errorp = TRUE; while (*str == ' ') str++; if (*str == '\0') break; -- cgit v1.2.3