mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
(print_sanitized_buffer): Don't care about
non-ASCII characaters. (sanitize_buffer): Ditto.
This commit is contained in:
parent
16f3d8396e
commit
9702e85d5d
@ -1,3 +1,9 @@
|
|||||||
|
2004-02-18 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* stringhelp.c (print_sanitized_buffer): Don't care about
|
||||||
|
non-ASCII characaters.
|
||||||
|
(sanitize_buffer): Ditto.
|
||||||
|
|
||||||
2004-02-12 Werner Koch <wk@gnupg.org>
|
2004-02-12 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* Makefile.am: Replaced INCLUDES by AM_CPPFLAGS.
|
* Makefile.am: Replaced INCLUDES by AM_CPPFLAGS.
|
||||||
|
@ -327,7 +327,7 @@ print_sanitized_buffer (FILE *fp, const void *buffer, size_t length,
|
|||||||
|
|
||||||
for (; length; length--, p++, count++)
|
for (; length; length--, p++, count++)
|
||||||
{
|
{
|
||||||
if (*p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim)
|
if (*p < 0x20 || *p == 0x7f || *p == delim)
|
||||||
{
|
{
|
||||||
putc ('\\', fp);
|
putc ('\\', fp);
|
||||||
count++;
|
count++;
|
||||||
@ -408,8 +408,7 @@ sanitize_buffer (const unsigned char *p, size_t n, int delim)
|
|||||||
/* first count length */
|
/* first count length */
|
||||||
for (save_n = n, save_p = p, buflen=1 ; n; n--, p++ )
|
for (save_n = n, save_p = p, buflen=1 ; n; n--, p++ )
|
||||||
{
|
{
|
||||||
if ( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim
|
if ( *p < 0x20 || *p == 0x7f || *p == delim || (delim && *p=='\\'))
|
||||||
|| (delim && *p=='\\'))
|
|
||||||
{
|
{
|
||||||
if ( *p=='\n' || *p=='\r' || *p=='\f'
|
if ( *p=='\n' || *p=='\r' || *p=='\f'
|
||||||
|| *p=='\v' || *p=='\b' || !*p )
|
|| *p=='\v' || *p=='\b' || !*p )
|
||||||
@ -426,8 +425,7 @@ sanitize_buffer (const unsigned char *p, size_t n, int delim)
|
|||||||
d = buffer = jnlib_xmalloc( buflen );
|
d = buffer = jnlib_xmalloc( buflen );
|
||||||
for ( ; n; n--, p++ )
|
for ( ; n; n--, p++ )
|
||||||
{
|
{
|
||||||
if (*p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim
|
if (*p < 0x20 || *p == 0x7f || *p == delim || (delim && *p=='\\')) {
|
||||||
||(delim && *p=='\\')) {
|
|
||||||
*d++ = '\\';
|
*d++ = '\\';
|
||||||
if( *p == '\n' )
|
if( *p == '\n' )
|
||||||
*d++ = 'n';
|
*d++ = 'n';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user