smartdevicelink / sdl_core

SmartDeviceLink In-Vehicle Software and Sample HMI
BSD 3-Clause "New" or "Revised" License
240 stars 245 forks source link

Check that message code exists before accessing #3852

Closed jacobkeeler closed 2 years ago

jacobkeeler commented 2 years ago

Fixes #3846

This PR is ready for review.

Risk

This PR makes no API changes.

Testing Plan

Summary

The GetUserFriendlyMsg function was inadvertently creating an empty messages entry when searching for a message code which didn't exist in the policy table during the PTU process, causing the table to be corrupted. This PR adds a check to this function to prevent this from happening.

Changelog

Bug Fixes

CLA

jacobkeeler commented 2 years ago

Note that I was only able to reproduce the issue directly in HTTP policy mode, but the check was added to all policy modes for safety