--- memedit-0.7.orig/memedit.l	2005-07-20 06:20:49.000000000 -0400
+++ memedit-0.7/memedit.l	2008-07-22 10:57:52.000000000 -0400
@@ -223,18 +223,18 @@
 }
 
 {VAR} {
-	yylval.tptr = malloc(sizeof(yytext));
+	yylval.tptr = malloc(strlen(yytext)+1);
 	if (yylval.tptr) strcpy(yylval.tptr, yytext);
 	else printf ("no mem in %s", __FUNCTION__);
-	if (debug > 4) printf ("FILE: >%s<\n", yytext); 
+	if (debug > 4) printf ("VAR: >%s<\n", yytext); 
 	return VARNAME;
 }
 
 {FILE} {
-	yylval.tptr = malloc(sizeof(yytext));
+	yylval.tptr = malloc(strlen(yytext)+1);
 	if (yylval.tptr) strcpy(yylval.tptr, yytext);
 	else printf ("no mem in %s", __FUNCTION__);
-	if (debug > 4) printf ("VAR: >%s<\n", yytext); 
+	if (debug > 4) printf ("FILE: >%s<\n", yytext); 
 	return FILENAME;
 }
 
