Commit 7c4ea8d0 authored by Jon Lech Johansen's avatar Jon Lech Johansen

  * Fixed a buffer overflow in CSSAuth()
parent 81cfe15f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* css.c: Functions for DVD authentification and unscrambling * css.c: Functions for DVD authentification and unscrambling
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: css.c,v 1.13 2001/10/16 16:51:28 stef Exp $ * $Id: css.c,v 1.14 2001/11/11 04:51:10 jlj Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* Hkan Hjort <d95hjort@dtek.chalmers.se> * Hkan Hjort <d95hjort@dtek.chalmers.se>
...@@ -98,7 +98,7 @@ int CSSAuth( dvdcss_handle dvdcss ) ...@@ -98,7 +98,7 @@ int CSSAuth( dvdcss_handle dvdcss )
{ {
/* structures defined in cdrom.h or dvdio.h */ /* structures defined in cdrom.h or dvdio.h */
unsigned char p_buffer[10]; unsigned char p_buffer[10];
char psz_warning[32]; char psz_warning[48];
int i_ret = -1; int i_ret = -1;
int i; int i;
...@@ -122,7 +122,7 @@ int CSSAuth( dvdcss_handle dvdcss ) ...@@ -122,7 +122,7 @@ int CSSAuth( dvdcss_handle dvdcss )
/* Init sequence, request AGID */ /* Init sequence, request AGID */
for( i = 1; i < 4 ; ++i ) for( i = 1; i < 4 ; ++i )
{ {
sprintf( psz_warning, "requesting AGID %d", i ); snprintf( psz_warning, sizeof(psz_warning), "requesting AGID %d", i );
_dvdcss_debug( dvdcss, psz_warning ); _dvdcss_debug( dvdcss, psz_warning );
i_ret = ioctl_ReportAgid( dvdcss->i_fd, &dvdcss->css.i_agid ); i_ret = ioctl_ReportAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
...@@ -185,7 +185,8 @@ int CSSAuth( dvdcss_handle dvdcss ) ...@@ -185,7 +185,8 @@ int CSSAuth( dvdcss_handle dvdcss )
if( memcmp( dvdcss->css.disc.p_key_check, if( memcmp( dvdcss->css.disc.p_key_check,
dvdcss->css.disc.p_key1, KEY_SIZE ) == 0 ) dvdcss->css.disc.p_key1, KEY_SIZE ) == 0 )
{ {
sprintf( psz_warning, "drive authentic, using variant %d", i ); snprintf( psz_warning, sizeof(psz_warning),
"drive authentic, using variant %d", i );
_dvdcss_debug( dvdcss, psz_warning ); _dvdcss_debug( dvdcss, psz_warning );
dvdcss->css.disc.i_varient = i; dvdcss->css.disc.i_varient = i;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment