[vlc-devel] commit: Fix strcasen?cmp overflow ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue May 27 17:01:28 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Tue May 27 18:02:45 2008 +0300| [a043d59ab6243e51b7bbee3a3fc22ab45f2113e8]

Fix strcasen?cmp overflow

Pointed out by Hannes Domani

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a043d59ab6243e51b7bbee3a3fc22ab45f2113e8
---

 include/vlc_fixups.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index f72ee52..b5a46a9 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -146,7 +146,7 @@ static inline int strcasecmp (const char *s1, const char *s2)
     for (size_t i = 0;; i++)
     {
         int d = tolower (s1[i]) - tolower (s2[i]);
-        if (d) return d;
+        if (d || !s1[i]) return d;
     }
     return 0;
 }
@@ -163,7 +163,7 @@ static inline int strncasecmp (const char *s1, const char *s2, size_t n)
     for (size_t i = 0; i < n; i++)
     {
         int d = tolower (s1[i]) - tolower (s2[i]);
-        if (d) return d;
+        if (d || !s1[i]) return d;
     }
     return 0;
 }




More information about the vlc-devel mailing list