1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-04 20:38:50 +01:00

* ttyio.c (tty_print_utf8_string, tty_print_utf8_string2): Use 0 to

indicate a string with no maximum size.  This prevents early truncation of
strings that contain control chars which are expanded into \xXX form.
This commit is contained in:
David Shaw 2003-02-19 19:23:55 +00:00
parent 047a84911a
commit 2bffa31fcc
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2003-02-19 David Shaw <dshaw@jabberwocky.com>
* ttyio.c (tty_print_utf8_string, tty_print_utf8_string2): Use 0
to indicate a string with no maximum size. This prevents early
truncation of strings that contain control chars which are
expanded into \xXX form.
2002-12-26 David Shaw <dshaw@jabberwocky.com> 2002-12-26 David Shaw <dshaw@jabberwocky.com>
* iobuf.c (iobuf_flush): Only print debug info if debugging is on. * iobuf.c (iobuf_flush): Only print debug info if debugging is on.

View File

@ -276,7 +276,7 @@ tty_print_utf8_string2( byte *p, size_t n, size_t max_n )
} }
if( i < n ) { if( i < n ) {
buf = utf8_to_native( p, n, 0 ); buf = utf8_to_native( p, n, 0 );
if( strlen( buf ) > max_n ) { if( max_n && (strlen( buf ) > max_n )) {
buf[max_n] = 0; buf[max_n] = 0;
} }
/*(utf8 conversion already does the control character quoting)*/ /*(utf8 conversion already does the control character quoting)*/
@ -284,7 +284,7 @@ tty_print_utf8_string2( byte *p, size_t n, size_t max_n )
m_free( buf ); m_free( buf );
} }
else { else {
if( n > max_n ) { if( max_n && (n > max_n) ) {
n = max_n; n = max_n;
} }
tty_print_string( p, n ); tty_print_string( p, n );
@ -294,7 +294,7 @@ tty_print_utf8_string2( byte *p, size_t n, size_t max_n )
void void
tty_print_utf8_string( byte *p, size_t n ) tty_print_utf8_string( byte *p, size_t n )
{ {
tty_print_utf8_string2( p, n, n ); tty_print_utf8_string2( p, n, 0 );
} }