summaryrefslogtreecommitdiffstats
path: root/perl/lib/Win
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-04-28 14:28:27 +0100
committerRichard Jones <rjones@redhat.com>2010-04-28 14:28:27 +0100
commit81cc08b749bde37f364400c2b983d1e73e8dde21 (patch)
tree1a555b5d53c1a9d60aba95a5f9a6bd11653a254f /perl/lib/Win
parent19ac2618ddfecb0ce6d98c3cbb2bfa2c3c11135c (diff)
downloadhivex-81cc08b749bde37f364400c2b983d1e73e8dde21.tar.gz
hivex-81cc08b749bde37f364400c2b983d1e73e8dde21.tar.xz
hivex-81cc08b749bde37f364400c2b983d1e73e8dde21.zip
regedit: Add implicit nul-termination when importing strings.
When you import a string value like: "Foo"="Bar" using Windows regedit program, implicit nul-termination is added to the value (not the key), so what is stored in the value would be something like: hex(1):42,00,61,00,72,00,00,00 where two of the trailing zero bytes come from the implicit terminator. This corrects the reg_import function so it works the same way.
Diffstat (limited to 'perl/lib/Win')
-rw-r--r--perl/lib/Win/Hivex/Regedit.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/perl/lib/Win/Hivex/Regedit.pm b/perl/lib/Win/Hivex/Regedit.pm
index 871e5ba..c69fda8 100644
--- a/perl/lib/Win/Hivex/Regedit.pm
+++ b/perl/lib/Win/Hivex/Regedit.pm
@@ -285,16 +285,19 @@ sub _parse_value
$type = 1;
$data = _parse_quoted_string ($1);
return undef unless defined $data;
+ $data .= "\0"; # Value strings are implicitly ASCIIZ.
$data = encode ($encoding, $data);
} elsif (m/^str\(([[:xdigit:]]+)\):(".*")$/) {
$type = hex ($1);
$data = _parse_quoted_string ($2);
return undef unless defined $data;
+ $data .= "\0"; # Value strings are implicitly ASCIIZ.
$data = encode ($encoding, $data);
} elsif (m/^(".*")$/) {
$type = 1;
$data = _parse_quoted_string ($1);
return undef unless defined $data;
+ $data .= "\0"; # Value strings are implicitly ASCIIZ.
$data = encode ($encoding, $data);
} else {
return undef;