diff --git a/ChangeLog b/ChangeLog
index df05833a7099c49c632e78518e7ac1192dcdde92..f0c1057889db8a1ca64b90269998c53961955b2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -846,3 +846,5 @@
 	* net/recvfrom.c: Fix errors in return value from non-blocking socket read.
 	* lib/lib_strcasecmp.c and lib/lib_strncasecmp.c.  Use of post-incremented
 	  argument to macro caused strcasecmp() and strncasecmp() to fail.
+	* lib/lib_strstr.c:  Length of substring off by one causes false alarm
+	  sub-string matches.
diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html
index 509b770aa548e735a660ee5021d24021e48a7bdf..cbaec7977287ef023264d2c180bc10b980bbae3d 100644
--- a/Documentation/NuttX.html
+++ b/Documentation/NuttX.html
@@ -1507,6 +1507,8 @@ nuttx-0.4.11 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
 	* net/recvfrom.c: Fix errors in return value from non-blocking socket read.
 	* lib/lib_strcasecmp.c and lib/lib_strncasecmp.c.  Use of post-incremented
 	  argument to macro caused strcasecmp() and strncasecmp() to fail.
+	* lib/lib_strstr.c:  Length of substring off by one causes false alarm
+	  sub-string matches.
 
 pascal-0.1.3 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
 
diff --git a/lib/lib_strncmp.c b/lib/lib_strncmp.c
index c50ec105ea5f3c53882a73de38811f9f10398d66..147dfc536987ad689e26b3156cf512b62148805a 100644
--- a/lib/lib_strncmp.c
+++ b/lib/lib_strncmp.c
@@ -1,7 +1,7 @@
 /****************************************************************************
  * lib/lib_strncmp.c
  *
- *   Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
+ *   Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
  *   Author: Gregory Nutt <spudmonkey@racsa.co.cr>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -52,10 +52,10 @@
 #ifndef CONFIG_ARCH_STRNCMP
 int strncmp(const char *cs, const char *ct, size_t nb)
 {
-  register signed char result = 0;
+  int result = 0;
   for (; nb > 0; nb--)
     {
-      if ((result = *cs - *ct++) != 0 || !*cs++)
+      if ((result = (int)*cs - (int)*ct++) != 0 || !*cs++)
         {
           break;
         }
diff --git a/lib/lib_strstr.c b/lib/lib_strstr.c
index 3649a6ac857b89747c24396cc3438f220641fb01..4e2eeb94cbd4bab9ea6af39171f0d73a7e336bb6 100644
--- a/lib/lib_strstr.c
+++ b/lib/lib_strstr.c
@@ -53,7 +53,9 @@ char *strstr(const char *str, const char *substr)
 
   /* Special case the empty substring */
 
-  ch = *substr++;
+  len = strlen(substr);
+  ch  = *substr++;
+
   if (!ch)
     {
       /* We'll say that an empty substring matches at the beginning of
@@ -66,8 +68,6 @@ char *strstr(const char *str, const char *substr)
   /* Search for the substring */
 
   candidate = str;
-  len       = strlen(substr);
-
   for (;;)
     {
       /* strchr() will return a pointer to the next occurrence of the