]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libfrog: cvt_u64 should use strtoull, not strtoll
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 25 Jun 2019 21:04:42 +0000 (17:04 -0400)
committerEric Sandeen <sandeen@redhat.com>
Tue, 25 Jun 2019 21:04:42 +0000 (17:04 -0400)
cvt_u64 converts a string to an unsigned 64-bit number, so it should use
strtoull, not strtoll because we don't want negative numbers here.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libfrog/convert.c

index 6239750757853ac90f836edee8460650eefde489..8d4d4077b3313b6c8061fb62f213bf0818c0f353 100644 (file)
@@ -105,14 +105,14 @@ cvt_s16(
  */
 uint64_t
 cvt_u64(
-       char            *s,
-       int             base)
+       char                    *s,
+       int                     base)
 {
-       long long       i;
-       char            *sp;
+       unsigned long long      i;
+       char                    *sp;
 
        errno = 0;
-       i = strtoll(s, &sp, base);
+       i = strtoull(s, &sp, base);
        /*
         * If the input would over or underflow, return the clamped
         * value and let the user check errno.  If we went all the