We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 983f72c + 0098d74 commit e6cdd17Copy full SHA for e6cdd17
src/transports/smart.c
@@ -266,7 +266,12 @@ static int git_smart__connect(
266
/* We now have loaded the refs. */
267
t->have_refs = 1;
268
269
- first = (git_pkt_ref *)git_vector_get(&t->refs, 0);
+ pkt = (git_pkt *)git_vector_get(&t->refs, 0);
270
+ if (pkt && GIT_PKT_REF != pkt->type) {
271
+ giterr_set(GITERR_NET, "invalid response");
272
+ return -1;
273
+ }
274
+ first = (git_pkt_ref *)pkt;
275
276
if ((error = git_vector_init(&symrefs, 1, NULL)) < 0)
277
return error;
0 commit comments