This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=a0f59e04b299e67e700f6cc491aab45472814a2c

commit a0f59e04b299e67e700f6cc491aab45472814a2c
Author: Guillem Jover <[email protected]>
AuthorDate: Mon Oct 8 02:46:26 2018 +0200

    dpkg-split: Use nfstrnsave() instead of nfmalloc() + memcpy()
---
 debian/changelog   |  2 ++
 dpkg-split/queue.c | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 73d76a09c..500111abe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -23,6 +23,8 @@ dpkg (1.19.2) UNRELEASED; urgency=medium
       Prompted by James Clarke <[email protected]>.
     - dpkg-query(1): Document the PAGER environment variable usage.
     - Dpkg(1): Add POD documentation about the module hierarchy and API.
+  * Code internals:
+    - dpkg-split: Use nfstrnsave() instead of nfmalloc() + memcpy().
   * Build system:
     - Distribute a LICENSE file on CPAN.
     - Do not make the Build.PL script executable.
diff --git a/dpkg-split/queue.c b/dpkg-split/queue.c
index 8ea2a30b4..1ef083ea5 100644
--- a/dpkg-split/queue.c
+++ b/dpkg-split/queue.c
@@ -62,23 +62,25 @@ decompose_filename(const char *filename, struct partqueue 
*pq)
   if (strspn(filename, "0123456789abcdef") != MD5HASHLEN ||
       filename[MD5HASHLEN] != '.')
     return false;
-  q = nfmalloc(MD5HASHLEN + 1);
-  memcpy(q, filename, MD5HASHLEN);
-  q[MD5HASHLEN] = '\0';
-  pq->info.md5sum= q;
+
+  pq->info.md5sum = nfstrnsave(filename, MD5HASHLEN);
+
   p = filename + MD5HASHLEN + 1;
   errno = 0;
   pq->info.maxpartlen = strtoimax(p, &q, 16);
   if (q == p || *q++ != '.' || errno != 0)
     return false;
+
   p = q;
   pq->info.thispartn = (int)strtol(p, &q, 16);
   if (q == p || *q++ != '.' || errno != 0)
     return false;
+
   p = q;
   pq->info.maxpartn = (int)strtol(p, &q, 16);
   if (q == p || *q || errno != 0)
     return false;
+
   return true;
 }
 

-- 
Dpkg.Org's dpkg

Reply via email to