From: Nathan Wagner Date: Sun, 16 Dec 2018 16:24:03 +0000 (+0000) Subject: fixup X-Git-Tag: v0.5.0~34 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=1eaf53ac134e49a81c82739d4ee8c98bdd975948 fixup --- diff --git a/lib/zpm.c b/lib/zpm.c index 11ee22c..3cc7632 100644 --- a/lib/zpm.c +++ b/lib/zpm.c @@ -307,11 +307,26 @@ int zpm_close(struct zpm *pkg) { static int zpm_sqlite_vercmp(void *not_used, int lena, const void *a, int lenb, const void *b) { - /* not sure what the ints are, possibly string lengths */ + int rv; + char *bufa, *bufb; + if (not_used != 0) fprintf(stderr, "sqlite vercmp not_used = %p\n", not_used); if (lena == 0 && lenb > 0) return 1; - return zpm_vercmp(a, b); + if (lenb == 0 && lena > 0) return -1; + + bufa = sqlite3_malloc(lena+1); + bufb = sqlite3_malloc(lenb+1); + + strncpy(bufa, a, lena); + strncpy(bufb, b, lenb); + bufa[lena] = 0; + bufb[lenb] = 0; + + rv = zpm_vercmp(bufa, bufb); + sqlite3_free(bufa); + sqlite3_free(bufb); + return rv; } int zpm_addvercmp(struct zpm *pkg) {