"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
check got_pathlist_append() calls for error
To:
Game of Trees <gameoftrees@openbsd.org>
Date:
Tue, 10 Jan 2023 23:17:10 +1100

Download raw body.

Thread
Catch a few missed got_pathlist_append() error checks in cmd_send() and
cmd_fetch().

diff /home/mark/src/got
commit - fd20239feff11b69919be913807aa1f371b06fb9
path + /home/mark/src/got
blob - 5e95ca3316302472e74abae334031fd6835220aa
file + got/got.c
--- got/got.c
+++ got/got.c
@@ -2483,14 +2483,18 @@ cmd_fetch(int argc, char *argv[])
 		if (!fetch_all_branches)
 			fetch_all_branches = remote->fetch_all_branches;
 		for (i = 0; i < remote->nfetch_branches; i++) {
-			got_pathlist_append(&wanted_branches,
+			error = got_pathlist_append(&wanted_branches,
 			    remote->fetch_branches[i], NULL);
+			if (error)
+				goto done;
 		}
 	}
 	if (TAILQ_EMPTY(&wanted_refs)) {
 		for (i = 0; i < remote->nfetch_refs; i++) {
-			got_pathlist_append(&wanted_refs,
+			error = got_pathlist_append(&wanted_refs,
 			    remote->fetch_refs[i], NULL);
+			if (error)
+				goto done;
 		}
 	}
 
@@ -9287,8 +9291,10 @@ cmd_send(int argc, char *argv[])
 		}
 	} else if (nbranches == 0) {
 		for (i = 0; i < remote->nsend_branches; i++) {
-			got_pathlist_append(&branches,
+			error = got_pathlist_append(&branches,
 			    remote->send_branches[i], NULL);
+			if (error)
+				goto done;
 		}
 	}
 

-- 
Mark Jamsek <fnc.bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68