server: Output incorrectly-terminated strings in hex format.
This commit is contained in:
parent
fb9955da8c
commit
b647ded03d
|
@ -182,7 +182,7 @@ static void dump_path( const struct key *key, const struct key *base, FILE *f )
|
||||||
/* dump a value to a text file */
|
/* dump a value to a text file */
|
||||||
static void dump_value( const struct key_value *value, FILE *f )
|
static void dump_value( const struct key_value *value, FILE *f )
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i, dw;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
if (value->namelen)
|
if (value->namelen)
|
||||||
|
@ -198,21 +198,23 @@ static void dump_value( const struct key_value *value, FILE *f )
|
||||||
case REG_SZ:
|
case REG_SZ:
|
||||||
case REG_EXPAND_SZ:
|
case REG_EXPAND_SZ:
|
||||||
case REG_MULTI_SZ:
|
case REG_MULTI_SZ:
|
||||||
if (value->type != REG_SZ) fprintf( f, "str(%d):", value->type );
|
/* only output properly terminated strings in string format */
|
||||||
|
if (value->len < sizeof(WCHAR)) break;
|
||||||
|
if (value->len % sizeof(WCHAR)) break;
|
||||||
|
if (((WCHAR *)value->data)[value->len / sizeof(WCHAR) - 1]) break;
|
||||||
|
if (value->type != REG_SZ) fprintf( f, "str(%x):", value->type );
|
||||||
fputc( '\"', f );
|
fputc( '\"', f );
|
||||||
if (value->data) dump_strW( (WCHAR *)value->data, value->len / sizeof(WCHAR), f, "\"\"" );
|
if (value->data) dump_strW( (WCHAR *)value->data, value->len / sizeof(WCHAR), f, "\"\"" );
|
||||||
fputc( '\"', f );
|
fprintf( f, "\"\n" );
|
||||||
break;
|
return;
|
||||||
|
|
||||||
case REG_DWORD:
|
case REG_DWORD:
|
||||||
if (value->len == sizeof(DWORD))
|
if (value->len != sizeof(dw)) break;
|
||||||
{
|
memcpy( &dw, value->data, sizeof(dw) );
|
||||||
DWORD dw;
|
fprintf( f, "dword:%08x\n", dw );
|
||||||
memcpy( &dw, value->data, sizeof(DWORD) );
|
return;
|
||||||
fprintf( f, "dword:%08x", dw );
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
/* else fall through */
|
|
||||||
default:
|
|
||||||
if (value->type == REG_BINARY) count += fprintf( f, "hex:" );
|
if (value->type == REG_BINARY) count += fprintf( f, "hex:" );
|
||||||
else count += fprintf( f, "hex(%x):", value->type );
|
else count += fprintf( f, "hex(%x):", value->type );
|
||||||
for (i = 0; i < value->len; i++)
|
for (i = 0; i < value->len; i++)
|
||||||
|
@ -228,8 +230,6 @@ static void dump_value( const struct key_value *value, FILE *f )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
fputc( '\n', f );
|
fputc( '\n', f );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue