File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
lib/ronin/support/encoding Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -262,6 +262,8 @@ def self.quote(data)
262262 if data =~ /[^[:print:]]/
263263 "$'#{ escape ( data ) } '"
264264 else
265+ # NOTE: '$' characters do not need to be escaped in single quoted
266+ # strings, but they *do* need to be escaped in double quoted strings.
265267 "\" #{ escape ( data ) . gsub ( '$' , '\$' ) } \" "
266268 end
267269 end
@@ -288,6 +290,8 @@ def self.unquote(data)
288290 if ( data . start_with? ( "$'" ) && data . end_with? ( "'" ) )
289291 unescape ( data [ 2 ..-2 ] )
290292 elsif ( data . start_with? ( '"' ) && data . end_with? ( '"' ) )
293+ # NOTE: double quoted strings only support escaping '"', '\', and
294+ # '$' characters.
291295 data [ 1 ..-2 ] . gsub ( /\\ ["\$ ]/ ) do |backslash_char |
292296 backslash_char [ 1 ]
293297 end
You can’t perform that action at this time.
0 commit comments