aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-05-23 19:48:19 -0700
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-05-24 13:36:06 -0700
commit958703d17ec8a7223e388da0805378579a328063 (patch)
tree287c92b8545c31635b7218025240aeb1029de549
parent94052c1cfd71199da5054919bf18fa88cd461049 (diff)
downloadcrda-958703d17ec8a7223e388da0805378579a328063.tar.gz
crda: fix regression when using reglib_for_each_country()
When reglib_for_each_country() was introduced via ebcbfcf4 its users were not updated with the possibility of rd being NULL due to the fact that the parsed file could be invalid or empty. The users mcgrof@frijol ~/devel/crda (git::master)$ git describe --contains 7a09f4dd v1.1.3~8 mcgrof@frijol ~/devel/crda (git::master)$ git describe --contains ebcbfcf45 v1.1.3~9 This regression exists since v1.1. Fix this. Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
-rw-r--r--intersect.c6
-rw-r--r--regdbdump.c7
2 files changed, 13 insertions, 0 deletions
diff --git a/intersect.c b/intersect.c
index 1c00a67..8f826a0 100644
--- a/intersect.c
+++ b/intersect.c
@@ -73,6 +73,12 @@ int main(int argc, char **argv)
intersected++;
}
+ if (!idx) {
+ printf("Invalid or empty regulatory file, note: "
+ "a binary regulatory file should be used.\n");
+ return -EINVAL;
+ }
+
if (idx == 1) {
world = (struct ieee80211_regdomain *) rd;
rd = NULL;
diff --git a/regdbdump.c b/regdbdump.c
index 26cbef7..dcbed71 100644
--- a/regdbdump.c
+++ b/regdbdump.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <errno.h>
#include "reglib.h"
int main(int argc, char **argv)
@@ -16,5 +17,11 @@ int main(int argc, char **argv)
free((struct ieee80211_regdomain *) rd);
}
+ if (!idx) {
+ printf("Invalid or empty regulatory file, note: "
+ "a binary regulatory file should be used.\n");
+ return -EINVAL;
+ }
+
return 0;
}