Skip to content

Commit 17b9d60

Browse files
committed
More path escaping to prevent faults on paths with ampersand
1 parent 62c83c8 commit 17b9d60

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/ruby-debug-ide/xml_printer.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ def print_file_filter_status(status)
199199
def print_breakpoints(breakpoints)
200200
print_element 'breakpoints' do
201201
breakpoints.sort_by{|b| b.id }.each do |b|
202-
print "<breakpoint n=\"%d\" file=\"%s\" line=\"%s\" />", b.id, b.source, b.pos.to_s
202+
print "<breakpoint n=\"%d\" file=\"%s\" line=\"%s\" />", b.id, CGI.escapeHTML(b.source), b.pos.to_s
203203
end
204204
end
205205
end
206206

207207
def print_breakpoint_added(b)
208-
print "<breakpointAdded no=\"%s\" location=\"%s:%s\"/>", b.id, b.source, b.pos
208+
print "<breakpointAdded no=\"%s\" location=\"%s:%s\"/>", b.id, CGI.escapeHTML(b.source), b.pos
209209
end
210210

211211
def print_breakpoint_deleted(b)
@@ -289,14 +289,14 @@ def print_methods(methods)
289289
# Events
290290

291291
def print_breakpoint(_, breakpoint)
292-
print("<breakpoint file=\"%s\" line=\"%s\" threadId=\"%d\"/>",
293-
breakpoint.source, breakpoint.pos, Debugger.current_context.thnum)
292+
print("<breakpoint file=\"%s\" line=\"%s\" threadId=\"%d\"/>",
293+
CGI.escapeHTML(breakpoint.source), breakpoint.pos, Debugger.current_context.thnum)
294294
end
295295

296296
def print_catchpoint(exception)
297297
context = Debugger.current_context
298298
print("<exception file=\"%s\" line=\"%s\" type=\"%s\" message=\"%s\" threadId=\"%d\"/>",
299-
context.frame_file(0), context.frame_line(0), exception.class, CGI.escapeHTML(exception.to_s), context.thnum)
299+
CGI.escapeHTML(context.frame_file(0)), context.frame_line(0), exception.class, CGI.escapeHTML(exception.to_s), context.thnum)
300300
end
301301

302302
def print_trace(context, file, line)

0 commit comments

Comments
 (0)