=================================================================
==8015==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xe0ec0a70087d at pc 0xe0ec0c615124 bp 0xffffe5b0fe50 sp 0xffffe5b0f630
WRITE of size 2047 at 0xe0ec0a70087d thread T0
    #0 0xe0ec0c615120 in memcpy ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:115
    #1 0xbd9eecbc10b8 in cap_get_ims_certificate /home/suraj/gb-poc/poc_cap_headers.c:18
    #2 0xbd9eecbc14c8 in main /home/suraj/gb-poc/poc_cap_headers.c:61
    #3 0xe0ec0c3984c0  (/lib/aarch64-linux-gnu/libc.so.6+0x284c0) (BuildId: 54ae5337044aaabab70d65e0c3444f7e4735e059)
    #4 0xe0ec0c398594 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x28594) (BuildId: 54ae5337044aaabab70d65e0c3444f7e4735e059)
    #5 0xbd9eecbc0f2c in _start (/home/suraj/gb-poc/poc_cap_headers+0xf2c) (BuildId: 8df2ec1377d3d7d5170954abcc7866b3de182ecd)

Address 0xe0ec0a70087d is located in stack of thread T0 at offset 2173 in frame
    #0 0xbd9eecbc1184 in main /home/suraj/gb-poc/poc_cap_headers.c:30

  This frame has 2 object(s):
    [48, 481) 'a' (line 50)
    [560, 2173) 'ims' (line 57) <== Memory access at offset 2173 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:115 in memcpy
Shadow bytes around the buggy address:
  0xe0ec0a700580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xe0ec0a700600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xe0ec0a700680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xe0ec0a700700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xe0ec0a700780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0xe0ec0a700800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00[05]
  0xe0ec0a700880: f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3
  0xe0ec0a700900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xe0ec0a700980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xe0ec0a700a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xe0ec0a700a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==8015==ABORTING
