Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

[Dystopia] Say Command Fix (11-19-2016, v1.0)


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 494
  • Lokalizacja:AMXX.PL
Offline

Napisano 25.11.2016 05:53

<div>There is an issue with string parsing for client side chat (the say and say_team commands) in Dystopia that will cause a server to crash; it does not manifest itself when using the say command, server side. To explain it, I will first describe a feature of the client side version of the commands: if the first character of the passed argument is &quot;, then the first, and final characters will be truncated. I imagine the rationale for this design choice is so that chat messages can be surrounded by quotes (this will be done to any message submitted through the chat prompt).<br /><br />So, if the submitted string is only two characters long, or shorter, this essentially creates an empty string. I believe the empty string condition is what crashes the server. This can work in unexpected ways to cause crashes, even from the chat prompt, which surrounds all messages with quotes. Consider the input &quot;;. The chat prompt would cause this to be submitted as `say &quot;&quot;;&quot;`. ; has the syntactical significance of indicating the end of a command, so it would be interpreted as: `say &quot;&quot; &lt;END OF COMMAND&gt; &quot;`. This produces the same empty string condition. <br /><br />Further evidence to support this is that the SourceMod server addon will prevent the crash if `say &quot;&quot;` is entered. I believe the section of code responsible for this is near the comment that starts with &quot;The server normally won't display empty say commands, but in this case it does&quot; here: <a href="https://github.com/a...atTriggers.cpp"target="_blank">https://github.com/a...riggers.cpp</a> The reason SourceMod does not block all incidences of the empty string condition, is that the check only occurs if the first and last characters are quotes, and the processing performed by SourceMod occurs before that performed by the game.<br /><br />This plugin is written in the SourcePawn transitional syntax, and seeks to remedy the issue. It will do so by checking arguments passed to the say and say_team commands by a client. If the argument begins with a &quot; but does not end with one, the produced chat message will consist of the entire string, with no characters truncated. Otherwise, the plugin will allow the standard behavior of the command. <br /><br />There were different ways that I could have handled the special case, and I think the way chosen for this plugin is fairly sane. My rationale for simply printing the entire string, is to default to the behavior of the server side say command. <br /><br />Changelog:<br /><div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">Code:</div>
<hr /><code style="margin:0px" dir="ltr" style="text-align:left">11-19-2016 (v1.0)&nbsp; <br /><br />* Initial release.</code><hr />
</div></div>


<br /> <div style="padding:6px">








<fieldset class="fieldset">
<legend>Attached Files</legend>
<table cellpadding="0" cellspacing="3" border="0">
<tr>
<td><img class="inlineimg" src="https://forums.allie.../attach/sp.gif"alt="File Type: sp" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
<td>


<a href="http://www.sourcemod...98"><strong>GetPlugin</strong></a> or
<a href="https://forums.allie...1480050885">GetSource</a> (SayCommandFix1.0.sp - 5.4 KB)


</td>
</tr>
</table>
</fieldset>


</div>

Wyświetl pełny artykuł




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych