patch-src_id3_c 976 B

12345678910111213141516171819202122232425262728293031323334
  1. $OpenBSD: patch-src_id3_c,v 1.1 2013/01/17 13:30:32 ajacoutot Exp $
  2. buffer overflow detected when writing ID3v2 tags:
  3. https://bugs.gentoo.org/show_bug.cgi?id=285105
  4. --- src/id3.c.orig Sat Jun 25 20:00:55 2005
  5. +++ src/id3.c Thu Jan 17 13:50:37 2013
  6. @@ -252,8 +252,8 @@ gboolean ID3v2TagFile(char *filename, char *title, cha
  7. if ( frames[ i ] ) {
  8. char *c_data = NULL;
  9. - char gen[ 5 ] = "( )";
  10. - char trk[ 4 ] = " ";
  11. + char gen[ 6 ] = "( )"; /* max unsigned char: 255 */
  12. + char trk[ 3 ] = " "; /* max CDDA tracks: 99 */
  13. switch( frameids[ i ] ) {
  14. case ID3FID_TITLE:
  15. @@ -278,12 +278,12 @@ gboolean ID3v2TagFile(char *filename, char *title, cha
  16. case ID3FID_CONTENTTYPE:
  17. c_data = gen;
  18. - sprintf( gen, "(%d)", genre ); /* XXX */
  19. + snprintf( gen, 6, "(%d)", genre );
  20. break;
  21. case ID3FID_TRACKNUM:
  22. c_data = trk;
  23. - sprintf( trk, "%d", tracknum ); /* XXX */
  24. + snprintf( trk, 3, "%d", tracknum );
  25. break;
  26. default: