summaryrefslogtreecommitdiff
path: root/apt-pkg/cacheset.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-01-16 19:51:23 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-01-16 19:51:23 +0100
commit62d8a765b9b37354efab6ca838cbdb7f347f7cac (patch)
tree4bd41cf6076cf264640ab2296f41c88379fecf44 /apt-pkg/cacheset.cc
parentbee0670b2dc8c50ddfc65731c00383da4d377cae (diff)
rework some code to fix some scan-build warnings
No visible functional changes, just code moved around and additional checks to eliminate impossible branches Reported-By: scan-build Git-Dch: Ignore
Diffstat (limited to 'apt-pkg/cacheset.cc')
-rw-r--r--apt-pkg/cacheset.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index 0147f7e86..29281aab9 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -73,6 +73,8 @@ bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci,
const char *start, *end;
parser.GetRec(start,end);
unsigned int const length = end - start;
+ if (unlikely(length == 0))
+ continue;
char buf[length];
strncpy(buf, start, length);
buf[length-1] = '\0';