Ticket #13825: 0001-Fixes-PVS-2477-and-2479-a-potential-null-pointer-der.patch

File 0001-Fixes-PVS-2477-and-2479-a-potential-null-pointer-der.patch, 1.3 KB (added by owenca, 6 years ago)
  • src/add-ons/kernel/file_systems/ntfs/libntfs/mft.c

    From 80f2bd4a29118326224d4075f9c267aee5a04722 Mon Sep 17 00:00:00 2001
    From: Owen <owenca@users.noreply.github.com>
    Date: Thu, 30 Nov 2017 17:41:54 +0000
    Subject: [PATCH] Fixes PVS #2477 and #2479: a potential null pointer
     dereference
    
    The 'ctx' pointer was utilized before it was verified against nullptr.
    ---
     src/add-ons/kernel/file_systems/ntfs/libntfs/mft.c | 6 ++++--
     1 file changed, 4 insertions(+), 2 deletions(-)
    
    diff --git a/src/add-ons/kernel/file_systems/ntfs/libntfs/mft.c b/src/add-ons/kernel/file_systems/ntfs/libntfs/mft.c
    index 0640efe..09eb00f 100644
    a b undo_alloc:  
    825825        if (ntfs_attr_record_resize(m, a, old_alen))
    826826            ntfs_log_error("Failed to restore attribute "
    827827                    "record.%s\n", es);
    828         ntfs_inode_mark_dirty(ctx->ntfs_ino);
     828        if (ctx != NULL)
     829            ntfs_inode_mark_dirty(ctx->ntfs_ino);
    829830    }
    830831    if (update_mp) {
    831832        if (ntfs_attr_update_mapping_pairs(vol->mftbmp_na, 0))
    undo_alloc:  
    11761177        if (ntfs_attr_record_resize(m, a, old_alen))
    11771178            ntfs_log_error("Failed to restore attribute "
    11781179                    "record.%s\n", es);
    1179         ntfs_inode_mark_dirty(ctx->ntfs_ino);
     1180        if (ctx != NULL)
     1181            ntfs_inode_mark_dirty(ctx->ntfs_ino);
    11801182    }
    11811183    if (update_mp) {
    11821184        if (ntfs_attr_update_mapping_pairs(vol->mft_na, 0))