=================================================================
==8016==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xf48ae43001e1 at pc 0xf48ae61e5124 bp 0xffffc1fff1d0 sp 0xffffc1ffe9b0
WRITE of size 1983 at 0xf48ae43001e1 thread T0
    #0 0xf48ae61e5120 in memcpy ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:115
    #1 0xbf1c318e1168 in cap_authenticate /home/suraj/gb-poc/poc_cap_headers.c:26
    #2 0xbf1c318e13b0 in main /home/suraj/gb-poc/poc_cap_headers.c:54
    #3 0xf48ae5f684c0  (/lib/aarch64-linux-gnu/libc.so.6+0x284c0) (BuildId: 54ae5337044aaabab70d65e0c3444f7e4735e059)
    #4 0xf48ae5f68594 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x28594) (BuildId: 54ae5337044aaabab70d65e0c3444f7e4735e059)
    #5 0xbf1c318e0f2c in _start (/home/suraj/gb-poc/poc_cap_headers+0xf2c) (BuildId: 8df2ec1377d3d7d5170954abcc7866b3de182ecd)

Address 0xf48ae43001e1 is located in stack of thread T0 at offset 481 in frame
    #0 0xbf1c318e1184 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 481 partially underflows 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:
  0xf48ae42fff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xf48ae42fff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xf48ae4300000: f1 f1 f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 00
  0xf48ae4300080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xf48ae4300100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0xf48ae4300180: 00 00 00 00 00 00 00 00 00 00 00 00[01]f2 f2 f2
  0xf48ae4300200: f2 f2 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00
  0xf48ae4300280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xf48ae4300300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xf48ae4300380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0xf48ae4300400: 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
==8016==ABORTING
