diff options
author | 2014-03-15 01:54:06 -0400 | |
---|---|---|
committer | 2014-03-15 01:54:06 -0400 | |
commit | 7edb85827c65468248d3d3352546fc076e822550 (patch) | |
tree | cb780e5b18f31e67019d3af0b2f5d0767b7bb109 /qdepends.c | |
parent | man: regenerate (diff) | |
download | portage-utils-7edb85827c65468248d3d3352546fc076e822550.tar.gz portage-utils-7edb85827c65468248d3d3352546fc076e822550.tar.bz2 portage-utils-7edb85827c65468248d3d3352546fc076e822550.zip |
qdepends: fix assert after eat_file rework
The assert no longer makes sense since the buffer is dynamically
allocated. Rework the logic to handle any sized buffer.
URL: https://bugs.gentoo.org/504636
Diffstat (limited to 'qdepends.c')
-rw-r--r-- | qdepends.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -484,13 +484,16 @@ _q_static int qdepends_vdb_deep_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv) IF_DEBUG(dep_dump_tree(dep_tree)); if (q_vdb_pkg_eat(pkg_ctx, "USE", &use, &use_len)) - use[0] = ' '; + use[0] = '\0'; for (ptr = use; *ptr; ++ptr) if (*ptr == '\n' || *ptr == '\t') *ptr = ' '; - len = strlen(use); - assert(len+1 < sizeof(use)); + len = ptr - use; + if (len == use_len) { + use_len += BUFSIZE; + use = xrealloc(use, use_len); + } use[len] = ' '; use[len+1] = '\0'; memmove(use+1, use, len); |