Ticket #11922: 0003-Add-more-checking-for-BFileInterface-related-methods.patch

File 0003-Add-more-checking-for-BFileInterface-related-methods.patch, 1.5 KB (added by Barrett, 5 years ago)
  • src/kits/media/MediaRoster.cpp

    From b6f57eb1ae4de5473806bf7d941e1322f3a452df Mon Sep 17 00:00:00 2001
    From: Dario Casalinuovo <b.vitruvio@gmail.com>
    Date: Wed, 18 Mar 2015 14:02:06 +0100
    Subject: [PATCH 03/13] Add more checking for BFileInterface related methods:
     both the validity of node and kind are now checked.
    
    ---
     src/kits/media/MediaRoster.cpp | 13 +++++++++++++
     1 file changed, 13 insertions(+)
    
    diff --git a/src/kits/media/MediaRoster.cpp b/src/kits/media/MediaRoster.cpp
    index be5f7bb..e16a66a 100644
    a b BMediaRoster::SetRefFor(const media_node& file_interface, const entry_ref& file,  
    28252825{
    28262826    CALLED();
    28272827
     2828    if (IS_INVALID_NODE(file_interface)
     2829        || (file_interface.kind & B_FILE_INTERFACE) == 0)
     2830        return B_MEDIA_BAD_NODE;
     2831
    28282832    fileinterface_set_ref_request request;
    28292833    fileinterface_set_ref_reply reply;
    28302834    status_t rv;
    BMediaRoster::GetRefFor(const media_node& node, entry_ref* _file,  
    28542858{
    28552859    CALLED();
    28562860
     2861    if (IS_INVALID_NODE(node)
     2862        || (node.kind & B_FILE_INTERFACE) == 0)
     2863        return B_MEDIA_BAD_NODE;
     2864
    28572865    if (!_file)
    28582866        return B_BAD_VALUE;
    28592867
    BMediaRoster::SniffRefFor(const media_node& file_interface,  
    28802888    const entry_ref& file, BMimeType* mimeType, float* _capability)
    28812889{
    28822890    CALLED();
     2891
     2892    if (IS_INVALID_NODE(file_interface)
     2893        || (file_interface.kind & B_FILE_INTERFACE) == 0)
     2894        return B_MEDIA_BAD_NODE;
     2895
    28832896    if (mimeType == NULL || _capability == NULL)
    28842897        return B_BAD_VALUE;
    28852898