[PATCH] fs:unicode: Fix the potential stack overflow risk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add judgment to fix the potential stack overflow risk.

Signed-off-by: jianchunfu <jianchunfu@xxxxxxxxxxxxxxxxxxxx>
---
 fs/unicode/mkutf8data.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/unicode/mkutf8data.c b/fs/unicode/mkutf8data.c
index bc1a7c8b5..8c2ace050 100644
--- a/fs/unicode/mkutf8data.c
+++ b/fs/unicode/mkutf8data.c
@@ -495,6 +495,10 @@ static struct node *alloc_node(struct node *parent)
 	int bitnum;
 
 	node = malloc(sizeof(*node));
+	if (!node) {
+		printf("Memory allocation failed\n");
+		exit(1);
+	}
 	node->left = node->right = NULL;
 	node->parent = parent;
 	node->leftnode = NODE;
-- 
2.18.4






[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux