util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] lslocks: fix type warning
@ 2015-01-03  9:20 Sami Kerola
  2015-01-03  9:20 ` [PATCH 2/2] fsck.minix: fix segmentation fault Sami Kerola
  2015-01-07  9:16 ` [PATCH 1/2] lslocks: fix type warning Karel Zak
  0 siblings, 2 replies; 4+ messages in thread
From: Sami Kerola @ 2015-01-03  9:20 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

misc-utils/lslocks.c:229:2: warning: format '%x' expects argument of type
'unsigned int *', but argument 3 has type 'int *' [-Wformat=]

Reference: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/locks.c?id=5e0f872c7d7e371fbdf09e864eddd24bddfda8fe#n2533
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 misc-utils/lslocks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c
index abc6a16..d351d7c 100644
--- a/misc-utils/lslocks.c
+++ b/misc-utils/lslocks.c
@@ -223,7 +223,7 @@ out:
  */
 static ino_t get_dev_inode(char *str, dev_t *dev)
 {
-	int maj = 0, min = 0;
+	unsigned int maj = 0, min = 0;
 	ino_t inum = 0;
 
 	sscanf(str, "%02x:%02x:%ju", &maj, &min, &inum);
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] fsck.minix: fix segmentation fault
  2015-01-03  9:20 [PATCH 1/2] lslocks: fix type warning Sami Kerola
@ 2015-01-03  9:20 ` Sami Kerola
  2015-01-07  9:17   ` Karel Zak
  2015-01-07  9:16 ` [PATCH 1/2] lslocks: fix type warning Karel Zak
  1 sibling, 1 reply; 4+ messages in thread
From: Sami Kerola @ 2015-01-03  9:20 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

Return from check_file() and check_file2() functions when maximum name
depth is reached.  The use unsafe strncpy() is also removed just to be on
safe side.

Addresses: https://bugs.debian.org/773892
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/fsck.minix.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c
index c0ed017..5ab19bb 100644
--- a/disk-utils/fsck.minix.c
+++ b/disk-utils/fsck.minix.c
@@ -112,6 +112,7 @@
 #include "all-io.h"
 #include "closestream.h"
 #include "rpmatch.h"
+#include "strutils.h"
 
 #define ROOT_INO 1
 #define YESNO_LENGTH 64
@@ -952,7 +953,9 @@ check_file(struct minix_inode *dir, unsigned int offset) {
 		ino = 0;
 	}
 	if (name_depth < MAX_DEPTH)
-		strncpy(name_list[name_depth], name, namelen);
+		xstrncpy(name_list[name_depth], name, namelen);
+	else
+		return;
 	name_depth++;
 	inode = get_inode(ino);
 	name_depth--;
@@ -977,7 +980,9 @@ check_file(struct minix_inode *dir, unsigned int offset) {
 	if (!inode)
 		return;
 	if (name_depth < MAX_DEPTH)
-		strncpy(name_list[name_depth], name, namelen);
+		xstrncpy(name_list[name_depth], name, namelen);
+	else
+		return;
 	name_depth++;
 	if (list) {
 		if (verbose)
@@ -1020,7 +1025,9 @@ check_file2(struct minix2_inode *dir, unsigned int offset) {
 		ino = 0;
 	}
 	if (name_depth < MAX_DEPTH)
-		strncpy(name_list[name_depth], name, namelen);
+		xstrncpy(name_list[name_depth], name, namelen);
+	else
+		return;
 	name_depth++;
 	inode = get_inode2(ino);
 	name_depth--;
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] lslocks: fix type warning
  2015-01-03  9:20 [PATCH 1/2] lslocks: fix type warning Sami Kerola
  2015-01-03  9:20 ` [PATCH 2/2] fsck.minix: fix segmentation fault Sami Kerola
@ 2015-01-07  9:16 ` Karel Zak
  1 sibling, 0 replies; 4+ messages in thread
From: Karel Zak @ 2015-01-07  9:16 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sat, Jan 03, 2015 at 09:20:04AM +0000, Sami Kerola wrote:
>  misc-utils/lslocks.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] fsck.minix: fix segmentation fault
  2015-01-03  9:20 ` [PATCH 2/2] fsck.minix: fix segmentation fault Sami Kerola
@ 2015-01-07  9:17   ` Karel Zak
  0 siblings, 0 replies; 4+ messages in thread
From: Karel Zak @ 2015-01-07  9:17 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sat, Jan 03, 2015 at 09:20:05AM +0000, Sami Kerola wrote:
>  disk-utils/fsck.minix.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-07  9:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-03  9:20 [PATCH 1/2] lslocks: fix type warning Sami Kerola
2015-01-03  9:20 ` [PATCH 2/2] fsck.minix: fix segmentation fault Sami Kerola
2015-01-07  9:17   ` Karel Zak
2015-01-07  9:16 ` [PATCH 1/2] lslocks: fix type warning Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).