]> git.pond.sub.org Git - empserver/commitdiff
(match_user, main): Use full buffer for fgets(); was off by one.
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 3 Oct 2005 10:45:00 +0000 (10:45 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 3 Oct 2005 10:45:00 +0000 (10:45 +0000)
src/lib/player/player.c
src/util/files.c

index aef6cd8c4799054b15ff83e0d61e2b2268a733bc..9f10d5c8f1174b7b82f101da04e39083848dd4e0 100644 (file)
@@ -393,11 +393,11 @@ match_user(char *file, struct player *p)
     }
     match = 0;
     while (!feof(fp) && !match) {
-       if (fgets(host, sizeof(host) - 1, fp) == NULL)
+       if (fgets(host, sizeof(host), fp) == NULL)
            break;
        if (host[0] == '#')
            continue;
-       if (fgets(user, sizeof(user) - 1, fp) == NULL)
+       if (fgets(user, sizeof(user), fp) == NULL)
            break;
        host[strlen(host) - 1] = '\0';
        user[strlen(user) - 1] = '\0';
index 9b228587d7c98bf8f99c8ada68124c4107c28a72..189ef1a701d1160100e7d7635f098a65d925f039 100644 (file)
@@ -118,7 +118,7 @@ main(int argc, char *argv[])
        printf("WARNING: this blasts the existing game in %s (if any)\n",
           datadir);
        printf("continue? ");
-       fgets(buf, sizeof(buf) - 1, stdin);
+       fgets(buf, sizeof(buf), stdin);
        if (*buf != 'y' && *buf != 'Y')
            exit(1);
     }