Skip to content

Commit 38f46c7

Browse files
Limit decoding to first 15 significant characters for C++
1 parent 1757e57 commit 38f46c7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cpp/openlocationcode.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ CodeArea Decode(const std::string &code) {
208208
clean_code = clean_code.substr(0,
209209
clean_code.find(internal::kPaddingCharacter));
210210
}
211+
if (clean_code.size() > internal::kMaximumDigitCount) {
212+
clean_code = clean_code.substr(0, internal::kMaximumDigitCount);
213+
}
211214
double resolution_degrees = internal::kEncodingBase;
212215
double latitude = 0.0;
213216
double longitude = 0.0;

0 commit comments

Comments
 (0)