Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null termination of VERSIONINFO strings? #25

Open
MaulingMonkey opened this issue Aug 30, 2020 · 0 comments
Open

Null termination of VERSIONINFO strings? #25

MaulingMonkey opened this issue Aug 30, 2020 · 0 comments

Comments

@MaulingMonkey
Copy link

TL;DR: Might be worth inserting \0 after the escaped v on line 400 here:

winres/lib.rs

Lines 396 to 404 in 82f55f8

writeln!(f, "{{\nBLOCK \"StringFileInfo\"")?;
writeln!(f, "{{\nBLOCK \"{:04x}04b0\"\n{{", self.language)?;
for (k, v) in self.properties.iter() {
if !v.is_empty() {
writeln!(f, "VALUE \"{}\", \"{}\"",
escape_string(k), escape_string(v))?;
}
}
writeln!(f, "}}\n}}")?;

MSDN Examples for VERSIONINFO resources appear to explicitly null terminate file/product version strings (VER_FILEVERSION_STR / VER_PRODUCTVERSION_STR). The docs aren't super clear on if this is actually necessary though. Other documentation is muddled: STRINGTABLE resources appear to be implicitly null terminated... but User-Defined Resources explicitly aren't: "RC does not automatically append a terminating null character to a string." I'd mostly worry about mixed Rust/C(++) codebases possibly reading back the version strings. E.g. LoadStringA(hinstance, id, &ptr, 0) will give you C-string pointer - not sure if you can get C-string pointers directly from Win32 for the version strings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant