diff options
author | Werner Koch <[email protected]> | 1999-12-31 11:44:29 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1999-12-31 11:44:29 +0000 |
commit | ed0b0e09d3eb529dc83fab4f24d4fc3abe649bd2 (patch) | |
tree | acdf31e4ef6ec6940169de6bd2a557451b8b73f9 /util | |
parent | See ChangeLog: Thu Dec 9 17:22:27 CET 1999 Werner Koch (diff) | |
download | gnupg-ed0b0e09d3eb529dc83fab4f24d4fc3abe649bd2.tar.gz gnupg-ed0b0e09d3eb529dc83fab4f24d4fc3abe649bd2.zip |
See ChangeLog: Fri Dec 31 12:48:31 CET 1999 Werner Koch
Diffstat (limited to 'util')
-rw-r--r-- | util/ChangeLog | 6 | ||||
-rw-r--r-- | util/memory.c | 8 | ||||
-rw-r--r-- | util/secmem.c | 2 | ||||
-rw-r--r-- | util/stringhelp.c | 22 | ||||
-rw-r--r-- | util/stringhelp.h | 5 |
5 files changed, 39 insertions, 4 deletions
diff --git a/util/ChangeLog b/util/ChangeLog index aadb8b4d0..923d35705 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,9 @@ +Fri Dec 31 12:48:31 CET 1999 Werner Koch <[email protected]> + + * memory.c (m_is_secure): New. + + * stringhelp.c (trim_trailing_spaces): New. + Wed Dec 8 21:58:32 CET 1999 Werner Koch <[email protected]> * strgutil.c (strcasecmp): New. diff --git a/util/memory.c b/util/memory.c index 712e20d26..db64ceeaf 100644 --- a/util/memory.c +++ b/util/memory.c @@ -37,7 +37,7 @@ #include "memory.h" #include "util.h" -/* FXIME: ugly hack. Need a prototype here bug can't include g10lib.h */ +/* FXIME: ugly hack. Need a prototype here but can't include g10lib.h */ int g10_private_is_secure( void *p ); @@ -642,4 +642,10 @@ FNAME(strdup)( const char *a FNAMEPRT ) return p; } +int +m_is_secure( const void *a ) +{ + return g10_private_is_secure(a); +} + diff --git a/util/secmem.c b/util/secmem.c index 84ec4c2a1..2eb2dfc9e 100644 --- a/util/secmem.c +++ b/util/secmem.c @@ -381,7 +381,7 @@ g10_private_is_secure( const void *p ) /**************** * Warning: This code might be called by an interrupt handler - * and frankly, thre should really be such a handler, + * and frankly, there should really be such a handler, * to make sure that the memory is wiped out. * We hope that the OS wipes out mlocked memory after * receiving a SIGKILL - it really should do so, otherwise diff --git a/util/stringhelp.c b/util/stringhelp.c index 16908f9a3..32318dad3 100644 --- a/util/stringhelp.c +++ b/util/stringhelp.c @@ -103,6 +103,28 @@ trim_spaces( char *str ) return str ; } +/**************** + * remove trailing white spaces + */ +char * +trim_trailing_spaces( char *string ) +{ + char *p, *mark; + + for( mark = NULL, p = string; *p; p++ ) { + if( isspace( *(byte*)p ) ) { + if( !mark ) + mark = p; + } + else + mark = NULL; + } + if( mark ) + *mark = '\0' ; + + return string ; +} + unsigned diff --git a/util/stringhelp.h b/util/stringhelp.h index 98b3ad551..c51cb552f 100644 --- a/util/stringhelp.h +++ b/util/stringhelp.h @@ -25,9 +25,10 @@ const char *memistr( const char *buf, size_t buflen, const char *sub ); char *mem2str( char *, const void *, size_t); char *trim_spaces( char *string ); -unsigned int trim_trailing_chars( byte *line, unsigned len, +char *trim_trailing_spaces( char *string ); +unsigned int trim_trailing_chars( unsigned char *line, unsigned len, const char *trimchars); -unsigned int trim_trailing_ws( byte *line, unsigned len ); +unsigned int trim_trailing_ws( unsigned char *line, unsigned len ); #ifndef HAVE_MEMICMP |