[Date Prev][Date Next] [Chronological] [Thread] [Top]

Compare bug in liblber/memory.c (ITS#3116)



Full_Name: William Edward Woody
Version: 2.2.8
OS: Win XP
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (198.6.50.31)


At line 347 of libraries\liblber\memory.c, the debug version of the memory
management code does the following compare:

if ((s - oldlen) > 0) { ...

The problem is that on Microsoft Visual C++, one of the two terms (I forgot
which off the top of my head) is an unsigned quantity, and the compare is
promoted to an unsigned value. 

Thus, the compare will almost always return true. This causes a number of
headaches when memory debugging is turned on while compiling for Visual C++
v6.0.

By rewriting the compare as:

if (s > oldlen) {

this appears to fix the problem.