We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3b5e9fb commit 049b501Copy full SHA for 049b501
generate/templates/manual/src/convenient_patch.cc
@@ -83,13 +83,12 @@ PatchData *createFromRaw(git_patch *raw) {
83
}
84
85
if (j == 0) {
86
- // calculate strlen only once for the first line of the first hunk.
87
- int calculatedContentLength = strlen(line->content);
+ int calculatedContentLength = line->content_len;
88
if (
89
calculatedContentLength > noNewlineStringLength &&
90
- !strcmp(
+ !strncmp(
91
&line->content[calculatedContentLength - noNewlineStringLength],
92
- "\n\\ No newline at end of file\n"
+ "\n\\ No newline at end of file\n", std::min(calculatedContentLength, noNewlineStringLength)
93
)) {
94
EOFFlag = true;
95
0 commit comments