From 0259c5bce2620a2f3def799a11cff5f6b6d38bab Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 19 Jan 2018 09:52:45 -0800 Subject: [PATCH] Guard against buffer overflow when serializing scanner /cc philipturnbull --- src/scanner.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scanner.cc b/src/scanner.cc index 3a7ea80..6a2484d 100644 --- a/src/scanner.cc +++ b/src/scanner.cc @@ -28,6 +28,7 @@ struct Scanner { } unsigned serialize(char *buffer) { + if (heredoc_delimiter.size() >= TREE_SITTER_SERIALIZATION_BUFFER_SIZE) return 0; heredoc_delimiter.copy(buffer, heredoc_delimiter.length()); return heredoc_delimiter.length(); }