From: Michael Schroeder Date: Mon, 23 Mar 2015 14:12:56 +0000 (+0100) Subject: fix namespace escaping in testcase_dep2str X-Git-Tag: 0.6.11~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=531571b9688daaa7ecf83531934d724601c53715;p=thirdparty%2Flibsolv.git fix namespace escaping in testcase_dep2str --- diff --git a/ext/testcase.c b/ext/testcase.c index 4f6fc6d7..14202525 100644 --- a/ext/testcase.c +++ b/ext/testcase.c @@ -333,13 +333,13 @@ testcase_id2str(Pool *pool, Id id, int isname) /* we need escaping! */ s2 = s2p = pool_alloctmpspace(pool, strlen(s) + bad * 2 + 1); - ss = s; if (!strncmp(s, "namespace:", 10)) { strcpy(s2p, "namespace\\3a"); s2p += 12; s += 10; } + ss = s; for (; *ss; ss++) { *s2p++ = *ss; @@ -1700,7 +1700,7 @@ dump_genid(Pool *pool, Strqueue *sq, Id id, int cnt) else { sprintf(cntbuf, "genid %2d: genid ", cnt++); - s = pool_tmpjoin(pool, cntbuf, id ? "lit" : "null", id ? pool_id2str(pool, id) : 0); + s = pool_tmpjoin(pool, cntbuf, id ? "lit " : "null", id ? pool_id2str(pool, id) : 0); } strqueue_push(sq, s); return cnt; @@ -2684,7 +2684,7 @@ testcase_read(Pool *pool, FILE *fp, char *testcase, Queue *job, char **resultp, id = pool_rel2id(pool, genid[ngenid] , genid[ngenid + 1], op->flags, 1); } else if (!strcmp(pieces[1], "lit")) - id = pool_str2id(pool, pieces[2], 1); + id = pool_str2id(pool, npieces > 2 ? pieces[2] : "", 1); else if (!strcmp(pieces[1], "null")) id = 0; else if (!strcmp(pieces[1], "dep"))