On 1/2/2019 8:13 AM, Honggang Li wrote: > Issue was detected by Coveiry. > ---- > Error: CLANG_WARNING: [#def21] > ibsim-0.7/umad2sim/umad2sim.c:374:26: warning: Potential buffer overflow. Replace with 'sizeof(path) - strlen(path) - 1' or use a safer 'strlcat' API > // strncat(path, "/pkeys", sizeof(path) - 1); > // ^~~~~~~~~~~~~~~~ > ibsim-0.7/umad2sim/umad2sim.c:374:26: note: Potential buffer overflow. Replace with 'sizeof(path) - strlen(path) - 1' or use a safer 'strlcat' API > // strncat(path, "/pkeys", sizeof(path) - 1); > // ^~~~~~~~~~~~~~~~ > // 372| /* /sys/class/infiniband/mthca0/ports/1/pkeys/0 */ > // 373| str = path + strlen(path); > // 374|-> strncat(path, "/pkeys", sizeof(path) - 1); > // 375| make_path(path); > // 376| for (i = 0; i < sizeof(sc->pkeys)/sizeof(sc->pkeys[0]); i++) { > ---- > > Signed-off-by: Honggang Li <honli@xxxxxxxxxx> Thanks. Applied. -- Hal