[systemd-bugs] [Bug 76745] New: shared: strv can't have more than 4294967295 elements

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Mar 28 09:39:33 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=76745

          Priority: medium
            Bug ID: 76745
          Assignee: systemd-bugs at lists.freedesktop.org
           Summary: shared: strv can't have more than 4294967295 elements
        QA Contact: systemd-bugs at lists.freedesktop.org
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: mustrumr97 at gmail.com
          Hardware: Other
            Status: NEW
           Version: unspecified
         Component: general
           Product: systemd

Even on computers with enough RAM. The following patch may not be complete but
you should get the idea.

--- a/src/shared/strv.h
+++ b/src/shared/strv.h
@@ -34,7 +34,7 @@
 #define _cleanup_strv_free_ _cleanup_(strv_freep)

 char **strv_copy(char * const *l);
-unsigned strv_length(char * const *l) _pure_;
+size_t strv_length(char * const *l) _pure_;

 int strv_extend_strv(char ***a, char **b);
 int strv_extend_strv_concat(char ***a, char **b, const char *suffix);
@@ -96,7 +96,7 @@
                 if (!first)                                     \
                         _l = (char**) &first;                   \
                 else {                                          \
-                        unsigned _n;                            \
+                        size_t _n;                            \
                         va_list _ap;                            \
                                                                 \
                         _n = 1;                                 \
--- a/src/shared/strv.c
+++ b/src/shared/strv.c
@@ -84,8 +84,8 @@
         return r;
 }

-unsigned strv_length(char * const *l) {
-        unsigned n = 0;
+size_t strv_length(char * const *l) {
+        size_t n = 0;

         if (!l)
                 return 0;
@@ -99,7 +99,7 @@
 char **strv_new_ap(const char *x, va_list ap) {
         const char *s;
         char **a;
-        unsigned n = 0, i = 0;
+        size_t n = 0, i = 0;
         va_list aq;

         /* As a special trick we ignore all listed strings that equal
@@ -204,7 +204,7 @@
         char *state;
         char *w;
         size_t l;
-        unsigned n, i;
+        size_t n, i;
         char **r;

         assert(s);
@@ -236,7 +236,7 @@
         char *state;
         char *w;
         size_t l;
-        unsigned n, i;
+        size_t n, i;
         char **r;

         assert(s);
@@ -265,7 +265,7 @@

 char **strv_split_newlines(const char *s) {
         char **l;
-        unsigned n;
+        size_t n;

         assert(s);

@@ -361,7 +361,7 @@

 int strv_push(char ***l, char *value) {
         char **c;
-        unsigned n;
+        size_t n;

         if (!value)
                 return 0;
@@ -436,7 +436,7 @@

 char **strv_parse_nulstr(const char *s, size_t l) {
         const char *p;
-        unsigned c = 0, i = 0;
+        size_t c = 0, i = 0;
         char **v;

         assert(s || l <= 0);

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-bugs/attachments/20140328/68e51d88/attachment-0001.html>


More information about the systemd-bugs mailing list