File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,9 @@ def pack(cls, data):
160160 return None
161161 if not data .endswith ('\x00 ' ):
162162 data += '\x00 '
163+ # Technically windows NDR seems to accept any bitstream that ends with '\x00\x00' here
164+ # And not limited to valid utf-16
165+ # Exemple: b'\x41\x00\x00\xD8'
163166 data = data .encode ("utf-16-le" )
164167 l = (len (data ) // 2 )
165168 result = struct .pack ("<3I" , l , 0 , l )
@@ -179,7 +182,7 @@ def unpack(cls, stream):
179182
180183 @classmethod
181184 def get_alignment (self ):
182- # Not sur , but size is on 4 bytes so...
185+ # Not sure , but size is on 4 bytes so...
183186 return 4
184187
185188class NdrCString (object ):
@@ -190,6 +193,10 @@ def pack(cls, data):
190193 return None
191194 if not data .endswith ('\x00 ' ):
192195 data += '\x00 '
196+ # Windows NDR seems to accept any bitstream in a FC_C_CSTRING
197+ # I was able to send range(1, 256) + b"\x00"
198+ # For now play safe for user and only accept encoded with always keep the same number of bytes
199+ data = data .encode ("ascii" )
193200 l = len (data )
194201 result = struct .pack ("<3I" , l , 0 , l )
195202 result += data
You can’t perform that action at this time.
0 commit comments