Bug 265 - Fixed memory access errors due to pointers to free'd mysql query data.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1849 e3e1d417-86f3-4887-817a-d78f3d33393f
pull/27/merge
stan 2006-01-21 17:58:46 +00:00
parent 9dcdcb8508
commit 7ad5388fc3
5 changed files with 34 additions and 29 deletions

View File

@ -36,7 +36,7 @@
FileCamera::FileCamera( const char *p_path, int p_width, int p_height, int p_palette, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) : Camera( FILE, p_width, p_height, p_palette, p_brightness, p_contrast, p_hue, p_colour, p_capture )
{
memcpy( path, p_path, sizeof(path) );
strncpy( path, p_path, sizeof(path) );
if ( capture )
{
Initialise();

View File

@ -43,8 +43,9 @@ short *LocalCamera::g_v_table;
short *LocalCamera::g_u_table;
short *LocalCamera::b_u_table;
LocalCamera::LocalCamera( const char *p_device, int p_channel, int p_format, int p_width, int p_height, int p_palette, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) : Camera( LOCAL, p_width, p_height, p_palette, p_brightness, p_contrast, p_hue, p_colour, p_capture ), device( p_device ), channel( p_channel ), format( p_format )
LocalCamera::LocalCamera( const char *p_device, int p_channel, int p_format, int p_width, int p_height, int p_palette, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) : Camera( LOCAL, p_width, p_height, p_palette, p_brightness, p_contrast, p_hue, p_colour, p_capture ), channel( p_channel ), format( p_format )
{
strncpy( device, p_device, sizeof(device) );
if ( !camera_count++ && capture )
{
Initialise();

View File

@ -33,25 +33,25 @@
class LocalCamera : public Camera
{
protected:
const char *device;
int channel;
int format;
char device[PATH_MAX];
int channel;
int format;
protected:
static int m_cap_frame;
static int m_cap_frame_active;
static int m_sync_frame;
static video_mbuf m_vmb;
static video_mmap *m_vmm;
static int m_videohandle;
static unsigned char *m_buffer;
static int camera_count;
static unsigned char *y_table;
static signed char *uv_table;
static short *r_v_table;
static short *g_v_table;
static short *g_u_table;
static short *b_u_table;
static int m_cap_frame;
static int m_cap_frame_active;
static int m_sync_frame;
static video_mbuf m_vmb;
static video_mmap *m_vmm;
static int m_videohandle;
static unsigned char *m_buffer;
static int camera_count;
static unsigned char *y_table;
static signed char *uv_table;
static short *r_v_table;
static short *g_v_table;
static short *g_u_table;
static short *b_u_table;
public:
LocalCamera( const char *p_device, int p_channel, int p_format, int p_width, int p_height, int p_palette, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture=true );

View File

@ -38,9 +38,13 @@
#include "zm.h"
#include "zm_remote_camera.h"
RemoteCamera::RemoteCamera( const char *p_host, const char *p_port, const char *p_path, int p_width, int p_height, int p_palette, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) : Camera( REMOTE, p_width, p_height, p_palette, p_brightness, p_contrast, p_hue, p_colour, p_capture ), host( p_host ), port( p_port ), path( p_path )
RemoteCamera::RemoteCamera( const char *p_host, const char *p_port, const char *p_path, int p_width, int p_height, int p_palette, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) : Camera( REMOTE, p_width, p_height, p_palette, p_brightness, p_contrast, p_hue, p_colour, p_capture )
{
auth = 0;
strncpy( host, p_host, sizeof(host) );
strncpy( port, p_port, sizeof(port) );
strncpy( path, p_path, sizeof(path) );
auth[0] = '\0';
auth64[0] = '\0';
sd = -1;
@ -88,9 +92,9 @@ void RemoteCamera::Initialise()
if ( auth_ptr )
{
auth = host;
host = auth_ptr+1;
*auth_ptr = '\0';
strncpy( auth, host, sizeof(auth) );
strncpy( host, auth_ptr+1, sizeof(host) );
Base64Encode( auth, auth64 );
}
@ -112,7 +116,7 @@ void RemoteCamera::Initialise()
snprintf( &(request[strlen(request)]), sizeof(request)-strlen(request), "User-Agent: %s/%s\n", config.http_ua, ZM_VERSION );
snprintf( &(request[strlen(request)]), sizeof(request)-strlen(request), "Host: %s\n", host );
snprintf( &(request[strlen(request)]), sizeof(request)-strlen(request), "Connection: Keep-Alive\n" );
if ( auth )
if ( auth[0] )
{
snprintf( &(request[strlen(request)]), sizeof(request)-strlen(request), "Authorization: Basic %s\n", auth64 );
}

View File

@ -33,11 +33,11 @@
class RemoteCamera : public Camera
{
protected:
const char *host;
const char *port;
const char *path;
const char *auth;
char auth64[256];
char host[64];
char port[8];
char path[256];
char auth[32];
char auth64[256];
protected:
char request[1024];