[llvm] f451957 - [ObjYAML] Use strcmp instead of strncmp

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 16:06:08 PST 2022


Author: Gregory Alfonso
Date: 2022-12-07T00:06:01Z
New Revision: f45195784168cced1e12fe888d6a906b8a4b424f

URL: https://github.com/llvm/llvm-project/commit/f45195784168cced1e12fe888d6a906b8a4b424f
DIFF: https://github.com/llvm/llvm-project/commit/f45195784168cced1e12fe888d6a906b8a4b424f.diff

LOG: [ObjYAML] Use strcmp instead of strncmp

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D139449

Added: 
    

Modified: 
    llvm/lib/ObjectYAML/MachOEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ObjectYAML/MachOEmitter.cpp b/llvm/lib/ObjectYAML/MachOEmitter.cpp
index 022c08e85fd9..c78c1f49088d 100644
--- a/llvm/lib/ObjectYAML/MachOEmitter.cpp
+++ b/llvm/lib/ObjectYAML/MachOEmitter.cpp
@@ -300,8 +300,7 @@ Error MachOWriter::writeSectionData(raw_ostream &OS) {
     case MachO::LC_SEGMENT_64:
       uint64_t segOff = is64Bit ? LC.Data.segment_command_64_data.fileoff
                                 : LC.Data.segment_command_data.fileoff;
-      if (0 ==
-          strncmp(&LC.Data.segment_command_data.segname[0], "__LINKEDIT", 16)) {
+      if (0 == strcmp(LC.Data.segment_command_data.segname, "__LINKEDIT")) {
         FoundLinkEditSeg = true;
         LinkEditOff = segOff;
         if (Obj.RawLinkEditSegment)


        


More information about the llvm-commits mailing list