[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[leafnode-list] Whoah. Bugs galore in hashing.
My eyes still ache after looking in
/* no good but this server isn't going to be scalable so shut up */
const char *lookup(const char *msgid)
static char *name = NULL;
unsigned int r;
/* ... */
i = strlen(name);
r = 0;
if (name[i] == '/')
name[i] = '@';
else if (name[i] == '>')
name[i + 1] = '\0';
r += (int) (name[i]);
r += ++i;
} while (name[i]);
i = strlen(spooldir) + 14; /* to the last digit */
r = (r % 999) + 1;
a) name is char, if that's signed or unsigned is implementation-dependent
b) r is unsigned int
c) name is cast to (signed) int.
d) the hashing function is embedded. Wrong. Belongs into a separate function.
Going to fix for 2.0b8_ma3.
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list