summaryrefslogtreecommitdiff
path: root/nuttx/lib/lib_strncmp.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-08-15 22:59:41 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-08-15 22:59:41 +0000
commit6c510b8a838ab27c348c2f5bac97211cbfaad3d6 (patch)
tree6c0e603d8c96335259d39caefc4425c8065043bc /nuttx/lib/lib_strncmp.c
parent56ab42eee7193d7d36b54522fa2dc251acb396fd (diff)
downloadpx4-nuttx-6c510b8a838ab27c348c2f5bac97211cbfaad3d6.tar.gz
px4-nuttx-6c510b8a838ab27c348c2f5bac97211cbfaad3d6.tar.bz2
px4-nuttx-6c510b8a838ab27c348c2f5bac97211cbfaad3d6.zip
strstr fails because length off by 1
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2022 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/lib/lib_strncmp.c')
-rw-r--r--nuttx/lib/lib_strncmp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/nuttx/lib/lib_strncmp.c b/nuttx/lib/lib_strncmp.c
index c50ec105e..147dfc536 100644
--- a/nuttx/lib/lib_strncmp.c
+++ b/nuttx/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;
}