From 6c510b8a838ab27c348c2f5bac97211cbfaad3d6 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 15 Aug 2009 22:59:41 +0000 Subject: 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 --- nuttx/lib/lib_strncmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'nuttx/lib/lib_strncmp.c') 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 * * 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; } -- cgit v1.2.3