(memrchr): Fixed implementation. Problem pointed out

by Adriaan de Groot.
This commit is contained in:
Werner Koch 2004-02-15 16:02:36 +00:00
parent 3d6d811a83
commit 6e468be50e
5 changed files with 21 additions and 8 deletions

View File

@ -1,3 +1,7 @@
2004-02-11 Werner Koch <wk@gnupg.org>
* autogen.sh (check_version): Removed bashism and simplified.
2004-02-10 Werner Koch <wk@gnupg.org> 2004-02-10 Werner Koch <wk@gnupg.org>
* configure.ac: Fixed funopen test change. * configure.ac: Fixed funopen test change.

3
THANKS
View File

@ -1,4 +1,5 @@
Adriaan de Groot adridg@cs.kun.nl
Alfons Hoogervorst alfons@proteus.demon.nl Alfons Hoogervorst alfons@proteus.demon.nl
Enno Cramer uebergeek@web.de Enno Cramer uebergeek@web.de
Frank Heckenbach frank@g-n-u.de Frank Heckenbach frank@g-n-u.de
@ -12,7 +13,7 @@ Timo Schulz twoaday@freakmail.de
Tommy Reynolds reynolds@redhat.com Tommy Reynolds reynolds@redhat.com
Copyright 2001, 2002 g10 Code GmbH Copyright 2001, 2002, 2004 g10 Code GmbH
This file is free software; as a special exception the author gives This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without unlimited permission to copy and/or distribute it, with or without

View File

@ -18,7 +18,7 @@ cvtver () {
} }
check_version () { check_version () {
if [ $(( `("$1" --version || echo "0") | cvtver` >= $2 )) == 1 ]; then if [ `("$1" --version || echo "0") | cvtver` -ge "$2" ]; then
return 0 return 0
fi fi
echo "**Error**: "\`$1\'" not installed or too old." >&2 echo "**Error**: "\`$1\'" not installed or too old." >&2

View File

@ -1,3 +1,8 @@
2004-02-15 Werner Koch <wk@gnupg.org>
* memrchr.c (memrchr): Fixed implementation. Problem pointed out
by Adriaan de Groot.
2004-02-01 Marcus Brinkmann <marcus@g10code.de> 2004-02-01 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (build_argv): Use --no-comment, not --comment "". * rungpg.c (build_argv): Use --no-comment, not --comment "".

View File

@ -1,5 +1,5 @@
/* memrchr.c - Replacement for memrchr. /* memrchr.c - Replacement for memrchr.
* Copyright (C) 2002 Free Software Foundation, Inc. * Copyright (C) 2002, 2004 Free Software Foundation, Inc.
* *
* This file is part of GnuPG. * This file is part of GnuPG.
* *
@ -27,10 +27,13 @@
void * void *
memrchr (const void *block, int c, size_t size) memrchr (const void *block, int c, size_t size)
{ {
void *p; const unsigned char *p = block;
for (p = block + size; p != block; p --) if (size)
{
for (p += size - 1; size; p--, size--)
if (*p == c) if (*p == c)
return p; return (void *)p;
return 0; }
return NULL;
} }