patch 8.2.1564: a few remaining errors from ubsan

Problem:    A few remaining errors from ubsan.
Solution:   Avoid the warnings. (Dominique Pellé, closes #6837)
diff --git a/src/spellfile.c b/src/spellfile.c
index d5ec3fe..12dedd6 100644
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -816,11 +816,15 @@
 
     // read the length bytes, MSB first
     for (i = 0; i < cnt_bytes; ++i)
-	cnt = (cnt << 8) + (unsigned)getc(fd);
-    if (cnt < 0)
     {
-	*cntp = SP_TRUNCERROR;
-	return NULL;
+	int c = getc(fd);
+
+	if (c == EOF)
+	{
+	    *cntp = SP_TRUNCERROR;
+	    return NULL;
+	}
+	cnt = (cnt << 8) + (unsigned)c;
     }
     *cntp = cnt;
     if (cnt == 0)