Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #192 from attilamolnar/insp12+chopfix

[1.2] Fix last character being chopped off in motd/rules
  • Loading branch information...
commit 5749279c7ec8447bbf6c1a2ee1886a9826e400c7 2 parents 622bf2b + 6ab2ef5
Sir Pogsalot authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/configreader.cpp
View
9 src/configreader.cpp
@@ -1960,7 +1960,14 @@ bool ServerConfig::ReadFile(file_cache &F, const char* fname)
while (!feof(file))
{
if (fgets(linebuf, sizeof(linebuf), file))
- linebuf[strlen(linebuf)-1] = 0;
+ {
+ // Cut off the ending newline, if any
+ size_t len = strlen(linebuf)-1;
+ if (linebuf[len] == '\n')
+ {
+ linebuf[len] = 0;
+ }
+ }
else
*linebuf = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.