@@ -25,17 +25,17 @@ def __init__(self, lnk_file, indata=None, cp=None):
25
25
start = 0
26
26
try :
27
27
if self ._lnk_file .has_name ():
28
- text , length = self .read (self ._raw [start :])
28
+ text , length = self .read (self ._raw [start :], limit_length = True )
29
29
self ._data ["description" ] = text
30
30
start += length
31
31
32
32
if self ._lnk_file .has_relative_path ():
33
- text , length = self .read (self ._raw [start :])
33
+ text , length = self .read (self ._raw [start :], limit_length = True )
34
34
self ._data ["relative_path" ] = text
35
35
start += length
36
36
37
37
if self ._lnk_file .has_working_dir ():
38
- text , length = self .read (self ._raw [start :])
38
+ text , length = self .read (self ._raw [start :], limit_length = True )
39
39
self ._data ["working_directory" ] = text
40
40
start += length
41
41
@@ -71,10 +71,10 @@ def command_line_arguments(self):
71
71
def icon_location (self ):
72
72
return self ._data .get ("icon_location" )
73
73
74
- def read (self , binary ):
74
+ def read (self , binary , limit_length = False ):
75
75
offset = 2
76
76
char_count = unpack ("<H" , binary [0 :offset ])[0 ]
77
- length = char_count
77
+ length = 260 if limit_length and char_count > 260 else char_count
78
78
79
79
if self ._lnk_file .is_unicode ():
80
80
self ._read = self .text_processor .read_unicode_string
0 commit comments