Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Merge branch 'master' of git://github.com/zxombie/pkg into zxombie-master
Matthew Seaman committed 12 years ago
commit 0d2e634cd1ef456e5d7be3f623dcb8792a04de0c
parent 95de717
1 file changed +6 -1
modified libpkg/pkg_elf.c
@@ -581,13 +581,18 @@ pkg_get_myarch(char *dest, size_t sz)

	data = elf_getdata(scn, NULL);
	src = data->d_buf;
-
	while (1) {
+
	while ((uintptr_t)src < ((uintptr_t)data->d_buf + data->d_size)) {
		memcpy(&note, src, sizeof(Elf_Note));
		src += sizeof(Elf_Note);
		if (note.n_type == NT_VERSION)
			break;
		src += note.n_namesz + note.n_descsz;
	}
+
	if ((uintptr_t)src >= ((uintptr_t)data->d_buf + data->d_size)) {
+
		ret = EPKG_FATAL;
+
		pkg_emit_error("fail to find the version elf note");
+
		goto cleanup;
+
	}
	osname = src;
	src += roundup2(note.n_namesz, 4);
	if (elfhdr.e_ident[EI_DATA] == ELFDATA2MSB)