aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--FICS/variable.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/FICS/variable.c b/FICS/variable.c
index 29d75ff..f564051 100644
--- a/FICS/variable.c
+++ b/FICS/variable.c
@@ -33,6 +33,7 @@
#include "stdinclude.h"
#include "common.h"
+#include <err.h>
#include <stdbool.h>
#include "board.h"
@@ -466,13 +467,18 @@ set_width(int p, char *var, char *val)
PUBLIC char *
Language(unsigned int i)
-{ // XXX
+{
static char *Lang[NUM_LANGS] = {
"English",
"Spanish",
"French",
"Danish"
};
+
+ if (i >= ARRAY_SIZE(Lang)) {
+ warnx("%s: invalid arg %u (too large)", __func__, i);
+ return Lang[0];
+ }
return Lang[i];
}