mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_SITL: ensure termination of readlink-derived progname
This commit is contained in:
parent
3b0bd67afb
commit
fe8d631964
|
@ -67,7 +67,11 @@ void dump_stack_trace()
|
|||
char *p;
|
||||
int n;
|
||||
|
||||
n = readlink("/proc/self/exe", progname, sizeof(progname));
|
||||
n = readlink("/proc/self/exe", progname, sizeof(progname)-1);
|
||||
if (n == -1) {
|
||||
strncpy(progname, "unknown", sizeof(progname));
|
||||
n = strlen(progname);
|
||||
}
|
||||
progname[n] = 0;
|
||||
|
||||
p = strrchr(progname, '/');
|
||||
|
|
Loading…
Reference in New Issue