Exemplo n.º 1
0
  def test_startsWithNulTerminatedString(self):
    #self.skipTest('')

    size, codec, txt = re_string.startsWithNulTerminatedString(self.test1)
    self.assertEquals(size, len(self.test1) )
    
    pass
Exemplo n.º 2
0
    def test_startsWithNulTerminatedString(self):
        # self.skipTest('')

        size, codec, txt = re_string.startsWithNulTerminatedString(self.test1)
        self.assertEquals(size, len(self.test1))

        pass
Exemplo n.º 3
0
 def checkString(self):
   ''' if there is no \x00 termination, its not a string
   that means that if we have a bad pointer in the middle of a string, 
   the first part will not be understood as a string'''
   bytes = self.struct._bytes[self.offset:]
   ret = re_string.startsWithNulTerminatedString(bytes)
   if not ret:
     self.typesTested.append(FieldType.STRING)
     #log.warning('STRING: This is not a string %s'%(self))
     return False
   else:
     self.size, self.encoding, self.value = ret 
     self.value += '\x00' # null terminated
     self.size += 1 # null terminated
     log.debug('STRING: Found a string "%s"/%d for encoding %s, field %s'%( repr(self.value), self.size, self.encoding, self))
     return True