]> hackdaworld.org Git - my-code/mp3db.git/commitdiff
buf terminated
authorhackbard <hackbard>
Sun, 20 Apr 2003 21:51:19 +0000 (21:51 +0000)
committerhackbard <hackbard>
Sun, 20 Apr 2003 21:51:19 +0000 (21:51 +0000)
mp3read.c

index 4bfc290b7da65ffd7b50b82a649ce0011df3778b..1e2a296c200bddb461a1803430e420e81c647e08 100644 (file)
--- 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<br>\n",buf);
 
  read(file_fd,&buf,MAX_ARTIST);
+ buf[MAX_ARTIST-1]=0;
  printf("artist: %s<br>\n",buf);
 
  read(file_fd,&buf,MAX_ALBUM);
+ buf[MAX_ALBUM-1]=0;
  printf("album: %s<br>\n",buf);
 
  // read(file_fd,&buf,MAX_YEAR);