Re: [GXemul-devel] NetBSD/hpcmips install fails under GXemul 0.6.1
Status: Alpha
Brought to you by:
gavare
|
From: Andreas G. <gs...@gs...> - 2019-06-06 09:28:25
|
Anders Gavare wrote:
> Can you add a printf statement next to that code and see what value
> machine->bootdev_id has when you run your scenario? 0 or 1?
I added this patch:
--- machine_pmax.cc~ 2019-04-17 20:26:19.000000000 +0300
+++ machine_pmax.cc 2019-06-05 18:02:44.839025490 +0300
@@ -806,6 +806,8 @@
#endif
strlcpy(bootpath, "5/rz1/", sizeof(bootpath));
+ printf("** bootdev_id=%d force_netboot=%d\n",
+ machine->bootdev_id, machine->force_netboot);
if (machine->bootdev_id < 0 || machine->force_netboot) {
/* tftp boot: */
strlcpy(bootpath, "5/tftp/", sizeof(bootpath));
and it printed:
** bootdev_id=0 force_netboot=0
machine: DECstation 5000/200 (3MAX, KN02) (25.00 MHz)
bootstring(+bootarg): boot 5/rz1/netbsd-INSTALL.gz -a
Looks like the code has undefined behavior: init_bootpath is set to
point to the local variable bootpath[], but by the time init_bootpath
is used as the source in strlcpy(), bootpath[] has already gone out of
scope.
--
Andreas Gustafsson, gs...@gs...
|