summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Keith <javelinanddart@gmail.com>2018-06-26 16:32:39 +0200
committerKevin Haggerty <haggertk@lineageos.org>2018-08-28 14:32:25 +0200
commit1fed6ada32b1e27016056b6a400282067ec4c251 (patch)
tree2b9e1e77922866d7d2eaf8992ce63038df4340d6
parent15641ff98eb6ed28147fb12634817dab3e79afd6 (diff)
downloadandroid_hardware_ril-1fed6ada32b1e27016056b6a400282067ec4c251.tar.gz
android_hardware_ril-1fed6ada32b1e27016056b6a400282067ec4c251.tar.bz2
android_hardware_ril-1fed6ada32b1e27016056b6a400282067ec4c251.zip
libril: Bounds check s_commands
* We shouldn't be assuming this is always going to be valid Change-Id: Ibd43133340d86f7c60ead5f7de63c73b05d00f2e
-rw-r--r--libril/ril.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libril/ril.cpp b/libril/ril.cpp
index ceec055..9b4e28c 100644
--- a/libril/ril.cpp
+++ b/libril/ril.cpp
@@ -233,6 +233,11 @@ addRequestToList(int serial, int slotId, int request) {
#endif
#endif
+ if (request >= (int)NUM_ELEMS(s_commands)) {
+ RLOGE("Request %s not supported", requestToString(request));
+ return NULL;
+ }
+
pRI = (RequestInfo *)calloc(1, sizeof(RequestInfo));
if (pRI == NULL) {
RLOGE("Memory allocation failed for request %s", requestToString(request));