Better bot error-handling, buffer overflow prevention in nudge client.

This commit is contained in:
Rob Nelson
2014-01-12 22:34:39 -08:00
parent 229c859df6
commit ada3be6e58
2 changed files with 14 additions and 4 deletions

View File

@@ -18,6 +18,10 @@ def pack(host, port, key, server_id, channel, message):
for in_data in message: # The rest of the arguments is data
d += [ht.unescape(in_data)]
data['data'] = ' '.join(d)
# Buffer overflow prevention.
if len(data['data']) > 400:
data['data'] = data['data'][:400]
except:
data['data'] = "NO DATA SPECIFIED"
pickled = pickle.dumps(data)