summaryrefslogtreecommitdiff
path: root/rgb.c
diff options
context:
space:
mode:
Diffstat (limited to 'rgb.c')
-rw-r--r--rgb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/rgb.c b/rgb.c
index bf4d032..287dcd6 100644
--- a/rgb.c
+++ b/rgb.c
@@ -80,6 +80,13 @@ main(int argc, char **argv)
else
dbname = RGB_DB;
+ if (strlen(dbname) > (sizeof(name) - 5)) {
+ fprintf (stderr,
+ "%s: dbm file name too long: \"%s\" (%lu max allowed)\n",
+ ProgramName, dbname, sizeof(name) - 5);
+ exit (1);
+ }
+
snprintf (name, sizeof(name), "%s.dir", dbname);
fd = open (name, O_WRONLY|O_CREAT, 0666);
if (fd < 0) {