]> Cypherpunks repositories - gostls13.git/commitdiff
5a/6a/8a: avoid fixed-sized file name buffer
authorDean Prichard <dean.prichard@gmail.com>
Sat, 23 Jan 2010 00:59:17 +0000 (16:59 -0800)
committerRuss Cox <rsc@golang.org>
Sat, 23 Jan 2010 00:59:17 +0000 (16:59 -0800)
R=rsc
CC=golang-dev
https://golang.org/cl/186279

src/cmd/5a/lex.c
src/cmd/6a/a.h
src/cmd/6a/lex.c
src/cmd/8a/a.h
src/cmd/8a/lex.c

index 44ce3bb40388a49c7e399b22b2cb41e6790a6b7b..540c12af59b34792ec816bbbbcdafabc6982926e 100644 (file)
@@ -139,9 +139,10 @@ main(int argc, char *argv[])
 int
 assemble(char *file)
 {
-       char ofile[100], incfile[20], *p;
+       char *ofile, incfile[20], *p;
        int i, of;
 
+       ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar)
        strcpy(ofile, file);
        p = utfrrune(ofile, '/');
        if(p) {
index 11ace638999019b931da5dd26e2acecd8e325d37..f1a0453156aa42647bb73c3aa2bd38508f42a18f 100644 (file)
@@ -168,6 +168,7 @@ EXTERN      char*   thestring;
 EXTERN int32   thunk;
 EXTERN Biobuf  obuf;
 
+void*   alloc(int32);
 void*  allocn(void*, int32, int32);
 void   errorexit(void);
 void   pushio(void);
index 7621021c4f1131c5a24ec9b85b7dc15768020f0c..a1814b0805e363aef0d16cd88a7e0a3e41d4c478 100644 (file)
@@ -139,9 +139,10 @@ main(int argc, char *argv[])
 int
 assemble(char *file)
 {
-       char ofile[100], incfile[20], *p;
+       char *ofile, incfile[20], *p;
        int i, of;
 
+       ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar)
        strcpy(ofile, file);
        p = utfrrune(ofile, pathchar());
        if(p) {
index bf0fc77083aabbc0ae55ece19f33775824762f10..c019ce4d66da068c87f4ba86a6f53ef7423e6cf2 100644 (file)
@@ -169,6 +169,7 @@ EXTERN      char*   thestring;
 EXTERN int32   thunk;
 EXTERN Biobuf  obuf;
 
+void*   alloc(int32);
 void*  allocn(void*, int32, int32);
 void   errorexit(void);
 void   pushio(void);
index a426713427915dc19a0c78d34a9b14f27e7c8711..a00ac49f6c718966fdc7de69380f510a30932edb 100644 (file)
@@ -138,9 +138,10 @@ main(int argc, char *argv[])
 int
 assemble(char *file)
 {
-       char ofile[100], incfile[20], *p;
+       char *ofile, incfile[20], *p;
        int i, of;
 
+       ofile = alloc(strlen(file)+3); // +3 for .x\0 (x=thechar)
        strcpy(ofile, file);
        p = utfrrune(ofile, pathchar());
        if(p) {