summaryrefslogtreecommitdiff
path: root/crda.c
diff options
context:
space:
mode:
Diffstat (limited to 'crda.c')
-rw-r--r--crda.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/crda.c b/crda.c
index 681ff73..97e1f53 100644
--- a/crda.c
+++ b/crda.c
@@ -6,7 +6,6 @@
#include <errno.h>
#include <stdio.h>
-#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -95,9 +94,19 @@ static int error_handler(struct sockaddr_nl __attribute__((unused)) *nla,
exit(err->error);
}
+/* Avoid stdlib */
+static int is_len_2(const char *alpha2)
+{
+ if (alpha2[0] == '\0' || (alpha2[1] == '\0'))
+ return 0;
+ if (alpha2[2] == '\0')
+ return 1;
+ return 0;
+}
+
static int is_valid_regdom(const char *alpha2)
{
- if (strlen(alpha2) != 2)
+ if (!is_len_2(alpha2))
return 0;
if (!is_alpha2(alpha2) && !is_world_regdom(alpha2))