Skip to content

Commit 4bd1703

Browse files
authored
Merge pull request microsoft#1874 from microsoft/suppress-codeql-false-positive
ReadObjectHook: suppress false positive
2 parents 5a3d6b0 + 92c2b32 commit 4bd1703

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

GVFS/GVFS.ReadObjectHook/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ int main(int, char *argv[])
8484
DisableCRLFTranslationOnStdPipes();
8585

8686
packet_txt_read(packet_buffer, sizeof(packet_buffer));
87-
if (strcmp(packet_buffer, "git-read-object-client"))
87+
if (strcmp(packet_buffer, "git-read-object-client")) // CodeQL [SM01932] `packet_txt_read()` either NUL-terminates or `die()`s
8888
{
8989
die(ReadObjectHookErrorReturnCode::ErrorReadObjectProtocol, "Bad welcome message\n");
9090
}
9191

9292
packet_txt_read(packet_buffer, sizeof(packet_buffer));
93-
if (strcmp(packet_buffer, "version=1"))
93+
if (strcmp(packet_buffer, "version=1")) // CodeQL [SM01932] `packet_txt_read()` either NUL-terminates or `die()`s
9494
{
9595
die(ReadObjectHookErrorReturnCode::ErrorReadObjectProtocol, "Bad version\n");
9696
}
@@ -105,7 +105,7 @@ int main(int, char *argv[])
105105
packet_flush();
106106

107107
packet_txt_read(packet_buffer, sizeof(packet_buffer));
108-
if (strcmp(packet_buffer, "capability=get"))
108+
if (strcmp(packet_buffer, "capability=get")) // CodeQL [SM01932] `packet_txt_read()` either NUL-terminates or `die()`s
109109
{
110110
die(ReadObjectHookErrorReturnCode::ErrorReadObjectProtocol, "Bad capability\n");
111111
}
@@ -125,13 +125,13 @@ int main(int, char *argv[])
125125
while (1)
126126
{
127127
packet_txt_read(packet_buffer, sizeof(packet_buffer));
128-
if (strcmp(packet_buffer, "command=get"))
128+
if (strcmp(packet_buffer, "command=get")) // CodeQL [SM01932] `packet_txt_read()` either NUL-terminates or `die()`s
129129
{
130130
die(ReadObjectHookErrorReturnCode::ErrorReadObjectProtocol, "Bad command\n");
131131
}
132132

133133
len = packet_txt_read(packet_buffer, sizeof(packet_buffer));
134-
if ((len != SHA1_LENGTH + 5) || strncmp(packet_buffer, "sha1=", 5))
134+
if ((len != SHA1_LENGTH + 5) || strncmp(packet_buffer, "sha1=", 5)) // CodeQL [SM01932] `packet_txt_read()` either NUL-terminates or `die()`s
135135
{
136136
die(ReadObjectHookErrorReturnCode::ErrorReadObjectProtocol, "Bad sha1 in get command\n");
137137
}

0 commit comments

Comments
 (0)