aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCSectionMachO.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MC/MCSectionMachO.cpp')
-rw-r--r--lib/MC/MCSectionMachO.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/lib/MC/MCSectionMachO.cpp b/lib/MC/MCSectionMachO.cpp
index 32d908ff68..33f5087d1e 100644
--- a/lib/MC/MCSectionMachO.cpp
+++ b/lib/MC/MCSectionMachO.cpp
@@ -260,18 +260,8 @@ std::string MCSectionMachO::ParseSectionSpecifier(StringRef Spec, // In.
StringRef StubSizeStr = Comma.second;
StripSpaces(StubSizeStr);
- // Convert the a null terminated buffer for strtoul.
- char TmpBuffer[32];
- if (StubSizeStr.size() >= 32)
- return"mach-o section specifier has a stub size specifier that is too long";
-
- memcpy(TmpBuffer, StubSizeStr.data(), StubSizeStr.size());
- TmpBuffer[StubSizeStr.size()] = 0;
-
- char *EndPtr;
- StubSize = strtoul(TmpBuffer, &EndPtr, 0);
-
- if (EndPtr[0] != 0)
+ // Convert the stub size from a string to an integer.
+ if (StubSizeStr.getAsInteger(0, StubSize))
return "mach-o section specifier has a malformed stub size";
return "";