diff --git a/src/timezone/pgtz.c b/src/timezone/pgtz.c
index 31dbf89..846f889 100644
--- a/src/timezone/pgtz.c
+++ b/src/timezone/pgtz.c
@@ -105,6 +105,7 @@ pg_open_tzfile(const char *name, char *canonname)
 		if (result >= 0)
 			return result;
 		/* If that didn't work, fall through to do it the hard way */
+		fullname[fullnamelen] = '\0';
 	}
 
 	/*
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
index 35ad5b8..4eb6a5f 100644
--- a/src/tools/msvc/Install.pm
+++ b/src/tools/msvc/Install.pm
@@ -384,9 +384,14 @@ sub GenerateTimezoneFiles
 	  || die "Could not find TZDATA line in timezone makefile\n";
 	my @tzfiles = split /\s+/, $1;
 
+	$mf =~ /^POSIXRULES\s*:?=\s*(.*)$/m
+	  || die "Could not find POSIXRULES line in timezone makefile\n";
+	my $posixrule = $1;
+	$posixrule =~ s/\s+$//;
+
 	print "Generating timezone files...";
 
-	my @args = ("$conf/zic/zic", '-d', "$target/share/timezone");
+	my @args = ("$conf/zic/zic", '-d', "$target/share/timezone", "-p", "$posixrule");
 	foreach (@tzfiles)
 	{
 		my $tzfile = $_;
