Просмотр исходного кода

dpkg-split: Make decompose_filename() and setpartsize() use strtoimax()

This will allow parsing large numbers, required for large file support.
Guillem Jover лет назад: 15
Родитель
Сommit
f9aaae4396
2 измененных файлов с 4 добавлено и 2 удалено
  1. 2 1
      dpkg-split/main.c
  2. 2 1
      dpkg-split/queue.c

+ 2 - 1
dpkg-split/main.c

@@ -25,6 +25,7 @@
 
 #include <assert.h>
 #include <limits.h>
+#include <inttypes.h>
 #if HAVE_LOCALE_H
 #include <locale.h>
 #endif
@@ -113,7 +114,7 @@ static void setpartsize(const struct cmdinfo *cip, const char *value) {
   long newpartsize;
   char *endp;
 
-  newpartsize= strtol(value,&endp,10);
+  newpartsize = strtoimax(value, &endp, 10);
   if (value == endp || *endp)
     badusage(_("invalid integer for --%s: `%.250s'"), cip->olong, value);
   if (newpartsize <= 0 || newpartsize > (INT_MAX >> 10))

+ 2 - 1
dpkg-split/queue.c

@@ -25,6 +25,7 @@
 
 #include <assert.h>
 #include <limits.h>
+#include <inttypes.h>
 #include <string.h>
 #include <fcntl.h>
 #include <dirent.h>
@@ -64,7 +65,7 @@ decompose_filename(const char *filename, struct partqueue *pq)
   q[MD5HASHLEN] = '\0';
   pq->info.md5sum= q;
   p = filename + MD5HASHLEN + 1;
-  pq->info.maxpartlen = strtol(p, &q, 16);
+  pq->info.maxpartlen = strtoimax(p, &q, 16);
   if (q == p || *q++ != '.')
     return false;
   p = q;