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,
|
2825 | 2825 | { |
2826 | 2826 | CALLED(); |
2827 | 2827 | |
| 2828 | if (IS_INVALID_NODE(file_interface) |
| 2829 | || (file_interface.kind & B_FILE_INTERFACE) == 0) |
| 2830 | return B_MEDIA_BAD_NODE; |
| 2831 | |
2828 | 2832 | fileinterface_set_ref_request request; |
2829 | 2833 | fileinterface_set_ref_reply reply; |
2830 | 2834 | status_t rv; |
… |
… |
BMediaRoster::GetRefFor(const media_node& node, entry_ref* _file,
|
2854 | 2858 | { |
2855 | 2859 | CALLED(); |
2856 | 2860 | |
| 2861 | if (IS_INVALID_NODE(node) |
| 2862 | || (node.kind & B_FILE_INTERFACE) == 0) |
| 2863 | return B_MEDIA_BAD_NODE; |
| 2864 | |
2857 | 2865 | if (!_file) |
2858 | 2866 | return B_BAD_VALUE; |
2859 | 2867 | |
… |
… |
BMediaRoster::SniffRefFor(const media_node& file_interface,
|
2880 | 2888 | const entry_ref& file, BMimeType* mimeType, float* _capability) |
2881 | 2889 | { |
2882 | 2890 | CALLED(); |
| 2891 | |
| 2892 | if (IS_INVALID_NODE(file_interface) |
| 2893 | || (file_interface.kind & B_FILE_INTERFACE) == 0) |
| 2894 | return B_MEDIA_BAD_NODE; |
| 2895 | |
2883 | 2896 | if (mimeType == NULL || _capability == NULL) |
2884 | 2897 | return B_BAD_VALUE; |
2885 | 2898 | |