Skip to content

Commit

Permalink
Fix invalid variables
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterSurda committed Aug 31, 2016
1 parent cc90747 commit 029b052
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/helper_msgcoding.py
@@ -1,5 +1,6 @@
#!/usr/bin/python2.7

import string
import msgpack
import zlib

Expand All @@ -8,7 +9,7 @@
BITMESSAGE_ENCODING_IGNORE = 0
BITMESSAGE_ENCODING_TRIVIAL = 1
BITMESSAGE_ENCODING_SIMPLE = 2
BITMESSAGE.ENCODING_EXTENDED = 3
BITMESSAGE_ENCODING_EXTENDED = 3

class MsgEncode(object):
def __init__(self, message, encoding = BITMESSAGE_ENCODING_SIMPLE):
Expand Down Expand Up @@ -71,14 +72,14 @@ def decodeExtended(self, data):
def decodeSimple(self, data):
bodyPositionIndex = string.find(data, '\nBody:')
if bodyPositionIndex > 1:
subject = message[8:bodyPositionIndex]
subject = data[8:bodyPositionIndex]
# Only save and show the first 500 characters of the subject.
# Any more is probably an attack.
subject = subject[:500]
body = message[bodyPositionIndex + 6:]
body = data[bodyPositionIndex + 6:]
else:
subject = ''
body = message
body = data
# Throw away any extra lines (headers) after the subject.
if subject:
subject = subject.splitlines()[0]
Expand Down

0 comments on commit 029b052

Please sign in to comment.