Fix for Program hack in bsdgames-2.17.25 core dumps when you enter 'i' after restoring a saved game
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bsdgames (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
The following patch fixes the problem. Cut and paste may have converted tabs to spaces (sorry).
I sent this to lists.debian.org as well, but not sure if that is the right place.
I am running Ubuntu 17.10 and package lists as bsdgames-2.17-25, but this fix was done in source listed as bsdgames-
*** hack.o_init.c.old 2003-12-16 20:47:37.000000000 -0600
--- hack.o_init.c 2018-03-25 20:35:59.362696144 -0600
***************
*** 184,191 ****
bwrite(fd, (char *) bases, sizeof bases);
bwrite(fd, (char *) objects, sizeof objects);
/*
! * as long as we use only one version of Hack/Quest we need not save
! * oc_name and oc_descr, but we must save oc_uname for all objects
*/
for (i = 0; i < SIZE(objects); i++) {
if (objects[
--- 184,190 ----
bwrite(fd, (char *) bases, sizeof bases);
bwrite(fd, (char *) objects, sizeof objects);
/*
! * Save oc_name, oc_descr, as well as oc_uname for all objects
*/
for (i = 0; i < SIZE(objects); i++) {
if (objects[
***************
*** 193,198 ****
--- 192,207 ----
bwrite(fd, (char *) &len, sizeof len);
bwrite(fd, objects[
}
+ if (objects[
+ len = strlen(
+ bwrite(fd, (char *) &len, sizeof len);
+ bwrite(fd, objects[i].oc_name, len);
+ }
+ if (objects[
+ len = strlen(
+ bwrite(fd, (char *) &len, sizeof len);
+ bwrite(fd, objects[
+ }
}
}
***************
*** 205,215 ****
--- 214,236 ----
mread(fd, (char *) bases, sizeof bases);
mread(fd, (char *) objects, sizeof objects);
for (i = 0; i < SIZE(objects); i++)
+ {
if (objects[
mread(fd, (char *) &len, sizeof len);
objects[
mread(fd, objects[
}
+ if (objects[
+ mread(fd, (char *) &len, sizeof len);
+ objects[i].oc_name = (char *) alloc(len);
+ mread(fd, objects[i].oc_name, len);
+ }
+ if (objects[
+ mread(fd, (char *) &len, sizeof len);
+ objects[i].oc_descr = (char *) alloc(len);
+ mread(fd, objects[
+ }
+ }
}
int
tags: | added: 2.17.28 close dr. in included please quathamer tobias version |
summary: |
- Program hack in bsdgames-2.17.25 core dumps when you enter 'i' after - restoring a saved game + Fix for Program hack in bsdgames-2.17.25 core dumps when you enter 'i' + after restoring a saved game |