mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-06-28 05:07:55 +08:00
rtemsbsd/rc_conf: Fixed non-nullterminated string causing crashes
This commit is contained in:
parent
1aa4cb8568
commit
16be3a7c7d
@ -869,7 +869,7 @@ rtems_bsd_run_rc_conf(const char* name, int timeout, bool verbose)
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
rc_conf = malloc(sb.st_size);
|
||||
rc_conf = malloc(sb.st_size + 1);
|
||||
if (rc_conf == NULL) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
@ -892,6 +892,8 @@ rtems_bsd_run_rc_conf(const char* name, int timeout, bool verbose)
|
||||
|
||||
fclose(file);
|
||||
|
||||
rc_conf[sb.st_size] = '\0';
|
||||
|
||||
r = rtems_bsd_run_rc_conf_script(name, rc_conf, timeout, verbose);
|
||||
|
||||
free(rc_conf);
|
||||
|
Loading…
x
Reference in New Issue
Block a user