Skip to content

Commit 9f8dd8c

Browse files
committed
Fix XMPUtils::ConvertToInt64 sscanf() type
This function uses sscanf() with "%lld" or "%llx" to parse a string to an integer. However, nothing guarantees that sizeof(XMP_Int64) == sizeof(long long); the latter is what sscanf will fill with either of these format strings, to avoid memory corruption. Use a long long to match the sscanf size, and let the return statement cast it to XMP_Int64.
1 parent 6156349 commit 9f8dd8c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xmpsdk/src/XMPUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ XMPUtils::ConvertToInt64 ( XMP_StringPtr strValue )
12151215

12161216
int count;
12171217
char nextCh;
1218-
XMP_Int64 result;
1218+
long long result;
12191219

12201220
if ( ! XMP_LitNMatch ( strValue, "0x", 2 ) ) {
12211221
count = sscanf ( strValue, "%lld%c", &result, &nextCh );

0 commit comments

Comments
 (0)