X-Git-Url: https://git.saurik.com/apple/ld64.git/blobdiff_plain/d696c285d331ab577dcabd00419d8c30336673da..74cfe461234fcf76aadb30ed686f281f06b555cd:/src/MachOFileAbstraction.hpp?ds=sidebyside diff --git a/src/MachOFileAbstraction.hpp b/src/MachOFileAbstraction.hpp index 6110e80..5d46cbf 100644 --- a/src/MachOFileAbstraction.hpp +++ b/src/MachOFileAbstraction.hpp @@ -39,6 +39,9 @@ struct uuid_command { }; #endif +#ifndef S_16BYTE_LITERALS + #define S_16BYTE_LITERALS 0xE +#endif #include "FileAbstraction.hpp" #include "Architectures.hpp" @@ -130,7 +133,7 @@ public: void set_cmdsize(uint32_t value) INLINE { E::set32(segment.fields.cmdsize, value); } const char* segname() const INLINE { return segment.fields.segname; } - void set_segname(const char* value) INLINE { memcpy(&segment.fields.segname, value, 16); } + void set_segname(const char* value) INLINE { strncpy(segment.fields.segname, value, 16); } uint64_t vmaddr() const INLINE { return P::getP(segment.fields.vmaddr); } void set_vmaddr(uint64_t value) INLINE { P::setP(segment.fields.vmaddr, value); } @@ -179,10 +182,10 @@ template class macho_section { public: const char* sectname() const INLINE { return section.fields.sectname; } - void set_sectname(const char* value) INLINE { memcpy(§ion.fields.sectname, value, 16); } + void set_sectname(const char* value) INLINE { strncpy(section.fields.sectname, value, 16); } const char* segname() const INLINE { return section.fields.segname; } - void set_segname(const char* value) INLINE { memcpy(§ion.fields.segname, value, 16); } + void set_segname(const char* value) INLINE { strncpy(section.fields.segname, value, 16); } uint64_t addr() const INLINE { return P::getP(section.fields.addr); } void set_addr(uint64_t value) INLINE { P::setP(section.fields.addr, value); }