@@ -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