Blame SOURCES/e2fsprogs-1.45.6-e2fsck-use-size_t-instead-of-int-in-string_copy.patch

e427d2
From 8a97e4f67f75a4584f7562b7e5d866431c88152e Mon Sep 17 00:00:00 2001
e427d2
From: Lukas Czerner <lczerner@redhat.com>
e427d2
Date: Fri, 5 Jun 2020 10:14:40 +0200
e427d2
Subject: [PATCH 09/46] e2fsck: use size_t instead of int in string_copy()
e427d2
Content-Type: text/plain
e427d2
e427d2
len argument in string_copy() is int, but it is used with malloc(),
e427d2
strlen(), strncpy() and some callers use sizeof() to pass value in. So
e427d2
it really ought to be size_t rather than int. Fix it.
e427d2
e427d2
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
e427d2
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
e427d2
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e427d2
---
e427d2
 e2fsck/e2fsck.h | 2 +-
e427d2
 e2fsck/util.c   | 2 +-
e427d2
 2 files changed, 2 insertions(+), 2 deletions(-)
e427d2
e427d2
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
e427d2
index feb605c7..7e0895c2 100644
e427d2
--- a/e2fsck/e2fsck.h
e427d2
+++ b/e2fsck/e2fsck.h
e427d2
@@ -608,7 +608,7 @@ extern void log_err(e2fsck_t ctx, const char *fmt, ...)
e427d2
 extern void e2fsck_read_bitmaps(e2fsck_t ctx);
e427d2
 extern void e2fsck_write_bitmaps(e2fsck_t ctx);
e427d2
 extern void preenhalt(e2fsck_t ctx);
e427d2
-extern char *string_copy(e2fsck_t ctx, const char *str, int len);
e427d2
+extern char *string_copy(e2fsck_t ctx, const char *str, size_t len);
e427d2
 extern int fs_proc_check(const char *fs_name);
e427d2
 extern int check_for_modules(const char *fs_name);
e427d2
 #ifdef RESOURCE_TRACK
e427d2
diff --git a/e2fsck/util.c b/e2fsck/util.c
e427d2
index d98b8e47..88e0ea8a 100644
e427d2
--- a/e2fsck/util.c
e427d2
+++ b/e2fsck/util.c
e427d2
@@ -135,7 +135,7 @@ void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned long size,
e427d2
 }
e427d2
 
e427d2
 char *string_copy(e2fsck_t ctx EXT2FS_ATTR((unused)),
e427d2
-		  const char *str, int len)
e427d2
+		  const char *str, size_t len)
e427d2
 {
e427d2
 	char	*ret;
e427d2
 
e427d2
-- 
e427d2
2.35.1
e427d2