From 62d8a765b9b37354efab6ca838cbdb7f347f7cac Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 16 Jan 2014 19:51:23 +0100 Subject: 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 --- apt-pkg/cacheset.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg/cacheset.cc') 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'; -- cgit v1.2.3