}
if (a->type == 1) {
int cmp;
+ if (a->s && ! b->s) return 1;
+ if (b->s && ! a->s) return -1;
+ if (!b->s && ! a->s) return 0;
cmp = strcmp(a->s, b->s);
if (cmp == 0) {
return 0;
}
return an < bn ? -1 : 1;
}
+ if (an == 0 && bn == 0) {
+ return 0;
+ }
cmp = ver_cmp(&a, &b);
if (cmp != 0) {
return cmp;
sqlite3 *db = 0;
int appid;
+ if (!pkg) {
+ return 0;
+ }
+
zpm_clearmem(pkg);
rc = sqlite3_open_v2(path, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
/* if exe, set neededs */
if (libelf_type(content) == ET_EXEC) {
- Elf64_Shdr *dsect;
+ Elf64_Shdr *dsect = 0;
char *elf;
elf = (char *)content;
dsect = (Elf64_Shdr *)(elf + phdr->p_offset);
}
}
+ if (!dsect) {
+ /* no dynamic section found */
+ return 1;
+ }
+
+#if 0
dyn = (Elf64_Dyn *)(elf + dsect->sh_offset);
if (!dyn) {
exit(9);
}
+#endif
dyn = (Elf64_Dyn *)dsect;
dsect = libelf_section(elf, SHT_DYNAMIC);