Commit Diff


commit - 56fdb92d3c609bfe29de12cc4a6ecd2ef03c920f
commit + a7dad3e298db784b5848eeb5d56e4ee96cba9ba0
blob - f447d1bc8ffad6facb7f8424555b091cd0781764
blob + 1b564d4809888720bd0184e50e26b6011e208434
--- gpass.c
+++ gpass.c
@@ -86,6 +86,8 @@ main(int argc, char *argv[])
 		err(1, "could not open the dictionary file %s", dictname);
 	for (char c = getc(dictfp); c != EOF; c = getc(dictfp))
 		nlines += (c == '\n');
+	if (nlines < 2)
+		errx(1, "the dictionary %s has less that 2 words", dictname);
 	int log2nlines = log2(nlines);
 	plen = plen / log2nlines + !!(plen % log2nlines);
 	plen += !plen;