Skip to content

Commit 34b3205

Browse files
committed
Fix potential use of uninitialized values
1 parent e781a0c commit 34b3205

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/pack.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,10 @@ int git_packfile_resolve_header(
509509
git_packfile_stream_free(&stream);
510510
if (error < 0)
511511
return error;
512-
} else
512+
} else {
513513
*size_p = size;
514+
base_offset = 0;
515+
}
514516

515517
while (type == GIT_OBJ_OFS_DELTA || type == GIT_OBJ_REF_DELTA) {
516518
curpos = base_offset;

src/patch_generate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static int create_binary(
284284
size_t b_datalen)
285285
{
286286
git_buf deflate = GIT_BUF_INIT, delta = GIT_BUF_INIT;
287-
size_t delta_data_len;
287+
size_t delta_data_len = 0;
288288
int error;
289289

290290
/* The git_delta function accepts unsigned long only */

src/transports/smart_protocol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ static int add_push_report_pkt(git_push *push, git_pkt *pkt)
728728
static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt, git_buf *data_pkt_buf)
729729
{
730730
git_pkt *pkt;
731-
const char *line, *line_end;
731+
const char *line, *line_end = NULL;
732732
size_t line_len;
733733
int error;
734734
int reading_from_buf = data_pkt_buf->size > 0;

0 commit comments

Comments
 (0)