[728] in Zephyr_Bugs
zephyr 2.0-beta2 xzwrite crashes heavily
daemon@ATHENA.MIT.EDU (Salvatore Valente)
Wed Dec 6 22:16:25 1995
Date: Wed, 6 Dec 1995 22:16:22 -0500
To: zephyr-bugs@MIT.EDU
From: Salvatore Valente <svalente@MIT.EDU>
zephyr 2.0-beta2 xzwrite crashes whenever a znol notification comes
in, and here's why:
void logins_deal(notice)
ZNotice_t *notice;
{
char *newdest;
int d;
d = notice->z_class_inst - strchr(notice->z_class_inst, '@');
newdest = (char *) Malloc(d+1, "while dealing with login/logout notice",
NULL);
strncpy(newdest, notice->z_class_inst, d);
newdest[d] = '\0';
Notice that `d' is always negative. You could simply reverse the
order of notice->z_class_inst and strchr(...), or you can decide that
pointer subtraction is really quite ugly and do something like this
instead:
d = 0;
while (((c = notice->z_class_inst[d]) != '@') && (c != 0))
d++;
Have a nice day.
-Sal.