From f2f4e8dc07fd9a816735a41f0117e1822763ccbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Fri, 18 Jun 2010 13:59:06 +0200 Subject: [PATCH] Fixed a possible null dereference when creating a stream --- src/ntfs-3g.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 080bfac6..23d6043f 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -1775,10 +1775,12 @@ static int ntfs_fuse_create_stream(const char *path, } if (ntfs_attr_add(ni, AT_DATA, stream_name, stream_name_len, NULL, 0)) res = -errno; + else + set_archive(ni); if ((res >= 0) + && fi && (fi->flags & (O_WRONLY | O_RDWR))) { - set_archive(ni); /* mark a future need to compress the last block */ if (ni->flags & FILE_ATTR_COMPRESSED) fi->fh |= CLOSE_COMPRESSED;