diff --git a/findversion.sh b/findversion.sh index e83a6c0bf5..35568de0ca 100755 --- a/findversion.sh +++ b/findversion.sh @@ -99,7 +99,7 @@ elif [ -d "$ROOT_DIR/.git" ]; then # No rev? Maybe it is a custom git-svn clone REV_NR=`LC_ALL=C git log --pretty=format:%b --grep="git-svn-id:.*@[0-9]*" -1 | sed "s@.*\@\([0-9]*\).*@\1@"` fi - TAG="`git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null`" + TAG="`git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null | sed 's@\^0$@@'`" if [ -n "$TAG" ]; then BRANCH="" REV="$TAG" diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs index 8a991b40e1..e16da751d4 100755 --- a/projects/determineversion.vbs +++ b/projects/determineversion.vbs @@ -227,6 +227,9 @@ Function DetermineSVNVersion() Loop If oExec.ExitCode = 0 Then version = oExec.StdOut.ReadLine() + If Right(version, 2) = "^0" Then + version = Left(version, Len(version) - 2) + End If branch = "" End If ' oExec.ExitCode = 0 End If ' Err.Number = 0 diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 539a586637..cacf9ada36 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -495,7 +495,11 @@ static bool ConKickOrBan(const char *argv, bool ban) if (strchr(argv, '.') == NULL && strchr(argv, ':') == NULL) { // banning with ID ClientID client_id = (ClientID)atoi(argv); - if (client_id == CLIENT_ID_SERVER) { + /* Don't kill the server, or the client doing the rcon. The latter can't be kicked because + * kicking frees closes and subsequently free the connection related instances, which we + * would be reading from and writing to after returning. So we would read or write data + * from freed memory up till the segfault triggers. */ + if (client_id == CLIENT_ID_SERVER || client_id == _redirect_console_to_client) { IConsolePrintF(CC_ERROR, "ERROR: Silly boy, you can not %s yourself!", ban ? "ban" : "kick"); return true; } diff --git a/src/newgrf.cpp b/src/newgrf.cpp index f97ec436f4..450bc8241d 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -4568,6 +4568,7 @@ static void FeatureMapSpriteGroup(ByteReader *buf) /* Skip number of cargo ids? */ buf->ReadByte(); uint16 groupid = buf->ReadWord(); + if (!IsValidGroupID(groupid, "FeatureMapSpriteGroup")) return; grfmsg(6, "FeatureMapSpriteGroup: Adding generic feature callback for feature %d", feature); @@ -6530,15 +6531,20 @@ static bool ChangeGRFPalette(size_t len, ByteReader *buf) buf->Skip(len); } else { char data = buf->ReadByte(); + GRFPalette pal = GRFP_GRF_UNSET; switch (data) { case '*': - case 'A': _cur_grfconfig->palette |= GRFP_GRF_ANY; break; - case 'W': _cur_grfconfig->palette |= GRFP_GRF_WINDOWS; break; - case 'D': _cur_grfconfig->palette |= GRFP_GRF_DOS; break; + case 'A': pal = GRFP_GRF_ANY; break; + case 'W': pal = GRFP_GRF_WINDOWS; break; + case 'D': pal = GRFP_GRF_DOS; break; default: grfmsg(2, "StaticGRFInfo: unexpected value '%02x' for 'INFO'->'PALS', ignoring this field", data); break; } + if (pal != GRFP_GRF_UNSET) { + _cur_grfconfig->palette &= ~GRFP_GRF_MASK; + _cur_grfconfig->palette |= pal; + } } return true; }