Fixing the following coding errors the coverity tools found:
* Event fixed_size_dest: You might overrun the 32-character fixed-size
string "devnm" by copying "cp + 1" without checking the length.
* Event fixed_size_dest: You might overrun the 32-character fixed-size
string "devnm" by copying "cp" without checking the length.
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
link[n] = 0;
cp = strrchr(link, '/');
if (cp) {
- strcpy(devnm, cp + 1);
+ snprintf(devnm, sizeof(devnm), "%s", cp + 1);
return devnm;
}
}
ep = strchr(cp, '/');
if (ep)
*ep = 0;
- strcpy(devnm, cp);
+ snprintf(devnm, sizeof(devnm), "%s", cp);
return devnm;
}
}