Guard against buffer overflow when serializing scanner
/cc philipturnbull
This commit is contained in:
parent
700d95cc95
commit
0259c5bce2
|
@ -28,6 +28,7 @@ struct Scanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned serialize(char *buffer) {
|
unsigned serialize(char *buffer) {
|
||||||
|
if (heredoc_delimiter.size() >= TREE_SITTER_SERIALIZATION_BUFFER_SIZE) return 0;
|
||||||
heredoc_delimiter.copy(buffer, heredoc_delimiter.length());
|
heredoc_delimiter.copy(buffer, heredoc_delimiter.length());
|
||||||
return heredoc_delimiter.length();
|
return heredoc_delimiter.length();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue