author | erik <erik> | 2007-02-08 01:45:16 (UTC) |
---|---|---|
committer | erik <erik> | 2007-02-08 01:45:16 (UTC) |
commit | 2e497f7cae45184184e2416114887095735958f5 (patch) (unidiff) | |
tree | a6b399d9bce5854dc7ad6c985b48965cf20680b0 /core/multimedia/opieplayer/modplug | |
parent | 853b61f97e718359bef95147ab3c7beb0705acda (diff) | |
download | opie-2e497f7cae45184184e2416114887095735958f5.zip opie-2e497f7cae45184184e2416114887095735958f5.tar.gz opie-2e497f7cae45184184e2416114887095735958f5.tar.bz2 |
Each file in this commit has a problem where it is possible to dereference
a pointer without that pointer being valid. This commit fixes each instance
of that.
Diffstat (limited to 'core/multimedia/opieplayer/modplug') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/modplug/sndfile.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/modplug/sndfile.cpp b/core/multimedia/opieplayer/modplug/sndfile.cpp index 1d0d610..799555c 100644 --- a/core/multimedia/opieplayer/modplug/sndfile.cpp +++ b/core/multimedia/opieplayer/modplug/sndfile.cpp | |||
@@ -1730,25 +1730,28 @@ void CSoundFile::CheckCPUUsage(UINT nCPU) | |||
1730 | if (nCPU > 90) | 1730 | if (nCPU > 90) |
1731 | { | 1731 | { |
1732 | m_dwSongFlags |= SONG_CPUVERYHIGH; | 1732 | m_dwSongFlags |= SONG_CPUVERYHIGH; |
1733 | } | 1733 | } |
1734 | } | 1734 | } |
1735 | 1735 | ||
1736 | 1736 | ||
1737 | BOOL CSoundFile::SetPatternName(UINT nPat, LPCSTR lpszName) | 1737 | BOOL CSoundFile::SetPatternName(UINT nPat, LPCSTR lpszName) |
1738 | //--------------------------------------------------------- | 1738 | //--------------------------------------------------------- |
1739 | { | 1739 | { |
1740 | char szName[MAX_PATTERNNAME] = ""; // changed from CHAR | 1740 | char szName[MAX_PATTERNNAME] = ""; // changed from CHAR |
1741 | if (nPat >= MAX_PATTERNS) return FALSE; | 1741 | if (nPat >= MAX_PATTERNS) return FALSE; |
1742 | if (lpszName) lstrcpyn(szName, lpszName, MAX_PATTERNNAME); | 1742 | if (lpszName) |
1743 | lstrcpyn(szName, lpszName, MAX_PATTERNNAME); | ||
1744 | else | ||
1745 | return FALSE; | ||
1743 | szName[MAX_PATTERNNAME-1] = 0; | 1746 | szName[MAX_PATTERNNAME-1] = 0; |
1744 | if (!m_lpszPatternNames) m_nPatternNames = 0; | 1747 | if (!m_lpszPatternNames) m_nPatternNames = 0; |
1745 | if (nPat >= m_nPatternNames) | 1748 | if (nPat >= m_nPatternNames) |
1746 | { | 1749 | { |
1747 | if (!lpszName[0]) return TRUE; | 1750 | if (!lpszName[0]) return TRUE; |
1748 | UINT len = (nPat+1)*MAX_PATTERNNAME; | 1751 | UINT len = (nPat+1)*MAX_PATTERNNAME; |
1749 | char *p = new char[len]; // changed from CHAR | 1752 | char *p = new char[len]; // changed from CHAR |
1750 | if (!p) return FALSE; | 1753 | if (!p) return FALSE; |
1751 | memset(p, 0, len); | 1754 | memset(p, 0, len); |
1752 | if (m_lpszPatternNames) | 1755 | if (m_lpszPatternNames) |
1753 | { | 1756 | { |
1754 | memcpy(p, m_lpszPatternNames, m_nPatternNames * MAX_PATTERNNAME); | 1757 | memcpy(p, m_lpszPatternNames, m_nPatternNames * MAX_PATTERNNAME); |