BTL2AP: compare strings with strcmp, not memcp
authorPascal Quantin <pascal.quantin@gmail.com>
Wed, 21 Sep 2016 09:09:43 +0000 (11:09 +0200)
committerAnders Broman <a.broman58@gmail.com>
Wed, 21 Sep 2016 11:20:33 +0000 (11:20 +0000)
Otherwise a string shorter than 7 characters will trigger an out of bounds access

Bug: 12825
Change-Id: I54a7909d74838dcb56583374e5753f877ff74fe2
Reviewed-on: https://code.wireshark.org/review/17826
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
epan/dissectors/packet-btl2cap.c

index db4c309f73cf56b91a6d14512389693d169f0f3d..355e715583f611a1eb55f8fd5f879d3844d30a1d 100644 (file)
@@ -22,7 +22,6 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@@ -1889,7 +1888,7 @@ dissect_disconnrequestresponse(tvbuff_t *tvb, int offset, packet_info *pinfo,
             service_name = val_to_str_ext_const(uuid.bt_uuid, &bluetooth_uuid_vals_ext, "Unknown");
         }
 
-        if (memcmp(service_name, "Unknown", 7) == 0) {
+        if (strcmp(service_name, "Unknown") == 0) {
             service_name = val_to_str_const(psm, psm_vals, "Unknown");
         }