• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

密猟オンラインサーバープログラム


Commit MetaInfo

Révision7 (tree)
l'heure2016-01-27 18:37:39
Auteurmanjihq

Message de Log

ユーザー名と動物名にコントロール文字、空白、カンマが含まれていたら
アンダーバーに置き換えるようにした

Change Summary

Modification

--- trunk/huntserv.c (revision 6)
+++ trunk/huntserv.c (revision 7)
@@ -12,6 +12,7 @@
1212 #ifdef USE_FORK
1313 #include <sys/wait.h>
1414 #endif
15+#include <ctype.h>
1516 #include "ctlsock.h"
1617 #include "hunt.h"
1718 #include "pktio.h"
@@ -2168,11 +2169,16 @@
21682169 char work[USERNAME_LEN];
21692170 for (i = 0; i < USERNAME_LEN; i++)
21702171 {
2171- if (*(pname + i) == '\0')
2172+ char c = *(pname + i);
2173+ if (c == '\0')
21722174 {
21732175 break;
21742176 }
2175- work[i] = *(pname + i);
2177+ if (c == ' ' || c == ',' || iscntrl ((int) c))
2178+ {
2179+ c = '_';
2180+ }
2181+ work[i] = c;
21762182 }
21772183 for (; i < USERNAME_LEN; i++)
21782184 {
@@ -6364,7 +6370,12 @@
63646370 int i;
63656371 for (i = 0; i < USERNAME_LEN && *p != '\0'; i++, p++)
63666372 {
6367- Animal[nanimal].name[i] = *p;
6373+ char c = *p;
6374+ if (c == ' ' || c == ',' || iscntrl ((int) c))
6375+ {
6376+ c = '_';
6377+ }
6378+ Animal[nanimal].name[i] = c;
63686379 }
63696380 for (; i < USERNAME_LEN; i++)
63706381 {