platform: msm_shared: Avoid buffer over read

While finding the partition entry from look up table, make sure
that the length of the input partition matches before doing a memcmp,
to avoid buffer overreads.

Change-Id: I24b318deeb7fad9aa1ce11fd2bf3fdf6302cc892
diff --git a/platform/msm_shared/partition_parser.c b/platform/msm_shared/partition_parser.c
index a702b45..387e9fc 100644
--- a/platform/msm_shared/partition_parser.c
+++ b/platform/msm_shared/partition_parser.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2013, 2015 The Linux Foundation. All rights reserved.
 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -856,10 +856,8 @@
 		return INVALID_PTN;
 	}
 	for (n = 0; n < partition_count; n++) {
-		if (!memcmp
-		    (name, &partition_entries[n].name, input_string_length)
-		    && input_string_length ==
-		    strlen((const char *)&partition_entries[n].name)) {
+		if ((input_string_length == strlen((const char *)&partition_entries[n].name))
+			&& !memcmp(name, &partition_entries[n].name, input_string_length)) {
 			return n;
 		}
 	}