aboutsummaryrefslogtreecommitdiffstats
path: root/sysgen
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-02-04 14:50:55 +0100
committerDmitry Vyukov <dvyukov@google.com>2016-02-05 22:12:15 +0100
commitba993a55b95a1cceced575b6583059fbb7735323 (patch)
treeccc9e1518ebb8414276ca5900ab79d51506d5185 /sysgen
parent50147480de478e4bcef17f10a978a9da0871ac29 (diff)
sys: terminate string constants with \x00
C expects string constants to be zero terminated. It worked to some degree probably because most memory is zeros in executor.
Diffstat (limited to 'sysgen')
-rw-r--r--sysgen/sysgen.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysgen/sysgen.go b/sysgen/sysgen.go
index a25655f79..7f5979c65 100644
--- a/sysgen/sysgen.go
+++ b/sysgen/sysgen.go
@@ -270,7 +270,7 @@ func generateArg(name, typ string, a []string, structs map[string]Struct, unname
if want := 1; len(a) != want {
failf("wrong number of arguments for %v arg %v, want %v, got %v", typ, name, want, len(a))
}
- fmt.Fprintf(out, "PtrType{%v, Dir: %v, Type: StrConstType{%v, Val: \"%v\"}}", common(), fmtDir("in"), common(), a[0])
+ fmt.Fprintf(out, "PtrType{%v, Dir: %v, Type: StrConstType{%v, Val: \"%v\"}}", common(), fmtDir("in"), common(), a[0]+"\\x00")
case "int8", "int16", "int32", "int64", "intptr":
if want := 0; len(a) != want {
failf("wrong number of arguments for %v arg %v, want %v, got %v", typ, name, want, len(a))