From 37897edda2f9484f7257e76cdc3459bc6ec2f7bc Mon Sep 17 00:00:00 2001 From: hackbard Date: Sun, 20 Apr 2003 21:51:19 +0000 Subject: [PATCH] buf terminated --- mp3read.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mp3read.c b/mp3read.c index 4bfc290..1e2a296 100644 --- a/mp3read.c +++ b/mp3read.c @@ -33,6 +33,8 @@ int main (int argc,char **argv) unsigned char buf[MAX_BUF_SIZE]; char filename[MAX_FILENAME]; + memset(buf,0,sizeof(buf)); + strcpy(filename,argv[1]); file_size=atoi(argv[2]); @@ -57,12 +59,15 @@ int main (int argc,char **argv) } read(file_fd,&buf,MAX_TITLE); + buf[MAX_TITLE-1]=0; printf("title: %s
\n",buf); read(file_fd,&buf,MAX_ARTIST); + buf[MAX_ARTIST-1]=0; printf("artist: %s
\n",buf); read(file_fd,&buf,MAX_ALBUM); + buf[MAX_ALBUM-1]=0; printf("album: %s
\n",buf); // read(file_fd,&buf,MAX_YEAR); -- 2.39.2