Closed Bug 173646 Opened 22 years ago Closed 18 years ago

flawfinder warnings in lib/mac

Categories

(SeaMonkey :: General, defect)

x86
Windows NT
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: morse, Assigned: saari)

References

Details

Heikki ran flawfinder (http://www.dwheeler.com/flawfinder) on Mozilla 1.0.1 
branch.

flawfinder found 42 warnings in lib/mac code (1939-1980). Go through
that list and for each warning:

* If it is false positive, comment here why it is not an issue
* If it is a real issue, make patch for it here and let's get them checked in

In addition to checking the branch, also check the trunk.

I realize that many of these files are now obsolete, especially the ones in 
lib/mac/MacMemoryAllocator.  Please indicate where that is the case as well.

1939) lib/mac/MacMemoryAllocator/src/LowLevel.c:431 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1940) lib/mac/MacMemoryAllocator/src/LowLevel.c:439 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1941) lib/mac/MacMemoryAllocator/src/LowLevel.c:442 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1942) lib/mac/MacMemoryAllocator/src/LowLevel.c:445 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1943) lib/mac/MacMemoryAllocator/src/LowLevel.c:448 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1944) lib/mac/MacMemoryAllocator/src/LowLevel.c:451 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1945) lib/mac/MacMemoryAllocator/src/LowLevel.c:456 [4] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf.

1946) lib/mac/MacMemoryAllocator/src/LowLevel.c:459 [4] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf.

1947) lib/mac/MacMemoryAllocator/src/MemoryTracker.c:649 [4] (buffer) strcpy: 
does not check for buffer overflows. Consider using strncpy or strlcpy.

1948) lib/mac/MacMemoryAllocator/src/MemoryTracker.c:785 [4] (buffer) strcpy: 
does not check for buffer overflows. Consider using strncpy or strlcpy.

1949) lib/mac/MacMemoryAllocator/src/MemoryTracker.c:1018 [1] (buffer) strcat: 
does not check for buffer overflows. Consider using strncat or strlcat. Risk is 
low because the source is a constant character.

1950) lib/mac/MacMemoryAllocator/src/MemoryTracker.c:1059 [4] (buffer) strcat: 
does not check for buffer overflows. Consider using strncat or strlcat.

1951) lib/mac/MacMemoryAllocator/src/MemoryTracker.c:1074 [1] (buffer) strcat: 
does not check for buffer overflows. Consider using strncat or strlcat. Risk is 
low because the source is a constant character.

1952) lib/mac/MacMemoryAllocator/src/MemoryTracker.c:1077 [4] (buffer) strcat: 
does not check for buffer overflows. Consider using strncat or strlcat.

1953) lib/mac/MacMemoryAllocator/src/MemoryTracker.c:1087 [4] (buffer) strcat: 
does not check for buffer overflows. Consider using strncat or strlcat.

1954) lib/mac/MacMemoryAllocator/src/MemoryTracker.c:1108 [4] (buffer) strcat: 
does not check for buffer overflows. Consider using strncat or strlcat.

1955) lib/mac/MacMemoryAllocator/src/StdCLevel.c:851 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1956) lib/mac/MacMemoryAllocator/src/StdCLevel.c:853 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1957) lib/mac/MacMemoryAllocator/src/StdCLevel.c:936 [4] (buffer) strcat: does 
not check for buffer overflows. Consider using strncat or strlcat.

1958) lib/mac/MacMemoryAllocator/src/StdCLevel.c:987 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1959) lib/mac/MacMemoryAllocator/src/StdCLevel.c:996 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1960) lib/mac/MacMemoryAllocator/src/StdCLevel.c:1012 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1961) lib/mac/MacMemoryAllocator/src/StdCLevel.c:1050 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1962) lib/mac/MacMemoryAllocator/src/StdCLevel.c:1052 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1963) lib/mac/MacMemoryAllocator/src/StdCLevel.c:1054 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1964) lib/mac/MacMemoryAllocator/src/StdCLevel.c:1056 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1965) lib/mac/MacMemoryAllocator/src/StdCLevel.c:1059 [4] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf.

1966) lib/mac/MacMemoryAllocator/src/StdCLevel.c:1074 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1967) lib/mac/MacMemoryAllocator/src/StdCLevel.c:1076 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1968) lib/mac/MacMemoryAllocator/src/StdCLevel.c:1078 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1969) lib/mac/MacMemoryAllocator/src/StdCLevel.c:1080 [2] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf. Risk is low because 
the source has a constant maximum length.

1970) lib/mac/MacMemoryAllocator/src/StdCLevel.c:1083 [4] (buffer) sprintf: does 
not check for buffer overflows. Use snprintf or vsnprintf.

1971) lib/mac/MacMemoryAllocator/src/StdCLevel.c:2769 [1] (buffer) strcat: does 
not check for buffer overflows. Consider using strncat or strlcat. Risk is low 
because the source is a constant character.

1972) lib/mac/MacMemoryAllocator/src/StdCLevel.c:2816 [4] (buffer) strcat: does 
not check for buffer overflows. Consider using strncat or strlcat.

1973) lib/mac/MacMemoryAllocator/src/StdCLevel.c:2817 [1] (buffer) strcat: does 
not check for buffer overflows. Consider using strncat or strlcat. Risk is low 
because the source is a constant character.

1974) lib/mac/MacMemoryAllocator/src/StdCLevel.c:2834 [4] (buffer) strcat: does 
not check for buffer overflows. Consider using strncat or strlcat.

1975) lib/mac/MacMemoryAllocator/src/StdCLevel.c:2844 [4] (buffer) strcat: does 
not check for buffer overflows. Consider using strncat or strlcat.

1976) lib/mac/MacMemoryAllocator/src/fastmem.c:586 [4] (format) printf: if 
format strings can be influenced by an attacker, they can be exploited. Use a 
constant for the format specification.

1977) lib/mac/MacMemoryAllocator/src/fastmem.c:676 [4] (format) printf: if 
format strings can be influenced by an attacker, they can be exploited. Use a 
constant for the format specification.

1978) lib/mac/NSStdLib/src/nsEnvironment.cpp:54 [4] (buffer) strcpy: does not 
check for buffer overflows. Consider using strncpy or strlcpy.

1979) lib/mac/NSStdLib/src/nsEnvironment.cpp:58 [4] (buffer) strcpy: does not 
check for buffer overflows. Consider using strncpy or strlcpy.

1980) lib/mac/NSStdLib/src/nsEnvironment.cpp:130 [3] (buffer) getenv: 
Environment variables are untrustable input if they can be set by an attacker. 
They can have any content and length, and the same variable can be set more than 
once.. Check environment variables carefully before using them.
Blocks: 148251
[random]=>saari
Assignee: asa → saari
1978-1980 are safe. strcpy is used on a buffer that is correctly allocated
dynamically. getenv is bogus.

I did not check the stuff in MacMemoryAllocator, some Mac head needs to either
say they are really obsolete or go through them and report their findings here.
Product: Browser → Seamonkey
Closing all open flawfinder bugs as WORKSFORME because we now have much better tools that do the same (well, better) kind of analysis (Coverity, Klocwork).
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.