Skip to content

Null termination of VERSIONINFO strings? #25

@MaulingMonkey

Description

@MaulingMonkey

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions