I worked around the segfault, and fixed a memory corruption bug that
caused a different crash. Can the maintainer please consider this new
version of the package?
http://shake.ath.cx:8080/~apw/debian/324803/
Here is the interdiff:
diff -u cdw-0.2.4/debian/changelog cdw-0.2.4/debian/changelog
--- cdw-0.2.4/debian/changelog
+++ cdw-0.2.4/debian/changelog
@@ -1,3 +1,10 @@
+cdw (0.2.4-3) unstable; urgency=low
+
+ * Fix memory corruption.
+ * Work around getenv segfaults. (closes: #324803).
+
+ -- Amos Waterland <[EMAIL PROTECTED]> Wed, 28 Mar 2007 23:00:08 +
+
cdw (0.2.4-2) unstable; urgency=low
* Remove circular dependency (closes: #340051).
only in patch2:
unchanged:
--- cdw-0.2.4.orig/src/color.c
+++ cdw-0.2.4/src/color.c
@@ -85,7 +85,8 @@
int colors[20];
int i;
-sprintf(line, "%s/.cdw.colors", getenv("HOME"));
+extern char *getenv_HOME;
+sprintf(line, "%s/.cdw.colors", getenv_HOME);
if ((color_conf=fopen(line, "r"))==NULL) {
init_pair(1, COLOR_CYAN, COLOR_BLUE);
init_pair(2, COLOR_BLUE, COLOR_WHITE);
only in patch2:
unchanged:
--- cdw-0.2.4.orig/src/gtkgui.c
+++ cdw-0.2.4/src/gtkgui.c
@@ -61,6 +61,8 @@
int select_window_gtk(bool real);
void fill_info_gtk();
+extern char *getenv_HOME;
+
/*/
@@ -956,7 +958,7 @@
if ( strlen(config.bootimg) ) {
char bootimage[255];
- sprintf(bootimage, "%s/.cdw/%s", getenv("HOME"), config.bootimg);
+ sprintf(bootimage, "%s/.cdw/%s", getenv_HOME, config.bootimg);
if ( (isofile=fopen(bootimage, "r"))==NULL ){
boot_exists=gtk_error_message(_("Boot image doesn't exist!"));
boot_exists=0;
@@ -1047,7 +1049,7 @@
if ( strlen(config.bootimg) ) {
char bootimage[255];
- sprintf(bootimage, "%s/.cdw/%s", getenv("HOME"),
config.bootimg);
+ sprintf(bootimage, "%s/.cdw/%s", getenv_HOME, config.bootimg);
if ( (isofile=fopen(bootimage, "r"))==NULL ){
boot_exists=gtk_error_message(_("Boot image doesn't
exist!"));
boot_exists=0;
@@ -1344,7 +1346,7 @@
bind_textdomain_codeset(PACKAGE, "UTF-8");
gtk_init(0, &argv);
-sprintf(homedir,"%.225s/.cdw",getenv("HOME"));
+sprintf(homedir,"%.225s/.cdw",getenv_HOME);
mkdir(homedir,S_IRWXU);
config=read_conf();
window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
only in patch2:
unchanged:
--- cdw-0.2.4.orig/src/main.c
+++ cdw-0.2.4/src/main.c
@@ -53,6 +53,7 @@
int select_window(bool real);
int add_to_dic();
int menupos;
+char *getenv_HOME;
ITEM **items, **cditems;
MENU *menu, *cdmenu;
@@ -237,7 +238,7 @@
mvwaddch(addwin, 0, 2, ACS_RTEE);
mvwprintw(addwin, 0, 3, " %s ", _("Add files"));
waddch(addwin, ACS_LTEE);
-sprintf(path,"%s",getenv("HOME"));
+sprintf(path,"%s",getenv_HOME);
load_dir(path, width, height);
highlight(0, filei[menupos], 0);
while ( (c=wgetch(addwin))!=27 ){
@@ -489,7 +490,7 @@
for (cnt=0; cntd_name)+strlen(dir)+4);
sprintf(ch,"%s/%s",dir,eps[cnt]->d_name);
- finfo=(struct stat *)malloc(sizeof(finfo)+100);
+ finfo=(struct stat *)malloc(sizeof(*finfo)+100);
ok=lstat(ch,finfo);
if ( (eps[cnt]->d_type=DT_DIR) )
dirsize(ch);
@@ -1092,7 +1093,8 @@
/* Read config */
mtrace();
-sprintf(homedir,"%.225s/.cdw",getenv("HOME"));
+getenv_HOME = getenv("HOME");
+sprintf(homedir,"%.225s/.cdw",getenv_HOME);
mkdir(homedir,S_IRWXU);
config=read_conf();
@@ -1338,7 +1340,7 @@
if ( strlen(config.bootimg) ) {
char bootimage[255];
- sprintf(bootimage, "%s/.cdw/%s", getenv("HOME"),
config.bootimg);
+ sprintf(bootimage, "%s/.cdw/%s", getenv_HOME,
config.bootimg);
if ( (isofile=fopen(bootimage, "r"))==NULL ){
boot_exists=dialogbox(_("Boot image doesn'n
exists!"), _("Boot image error"), 0);
boot_exists=0;
@@ -1426,7 +1428,7 @@
if ( strlen(config.bootimg) ) {
char bootimage[255];
- sprintf(bootimage, "%s/.cdw/%s", getenv("HOME"),
config.bootimg);
+ sprintf(bootimage, "%s/.cdw/%s", getenv_HOME,
con