diff options
author | dscho <dscho> | 2002-08-31 14:09:39 +0000 |
---|---|---|
committer | dscho <dscho> | 2002-08-31 14:09:39 +0000 |
commit | 0024d7472768635915ee6cc511fc258c121b9b9c (patch) | |
tree | 580af88fd581169fbdd2e3a5a02df54e918acc99 | |
parent | 08bfb7cb63cd2e9ed35f854965d80833e1e9c8b3 (diff) | |
download | libtdevnc-0024d7472768635915ee6cc511fc258c121b9b9c.tar.gz libtdevnc-0024d7472768635915ee6cc511fc258c121b9b9c.zip |
compiler warnings and format vulnerabilities fixed
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | cvs_update_anonymously | 1 | ||||
-rw-r--r-- | httpd.c | 2 | ||||
-rw-r--r-- | mac.c | 4 | ||||
-rw-r--r-- | pnmshow24.c | 2 | ||||
-rw-r--r-- | vncev.c | 13 | ||||
-rw-r--r-- | x11vnc.c | 9 | ||||
-rw-r--r-- | zippy.c | 3 |
8 files changed, 25 insertions, 13 deletions
@@ -28,7 +28,7 @@ OSX_LIBS = -framework ApplicationServices -framework Carbon -framework IOKit # for x11vnc #XLIBS = -L/usr/X11R6/lib -lXtst -lXext -lX11 -XLIBS = -L/usr/lib32 -lXtst -lXext -lX11 +XLIBS = -L/usr/X11R6/lib -L/usr/lib32 -lXtst -lXext -lX11 SOURCES=main.c rfbserver.c sraRegion.c auth.c sockets.c \ stats.c corre.c hextile.c rre.c translate.c cutpaste.c \ @@ -42,6 +42,8 @@ INSTALLHEADER=rfb.h rfbproto.h sraRegion.h keysym.h all: example pnmshow storepasswd +all_examples: example pnmshow x11vnc x11vnc_static sratest blooptest pnmshow24 fontsel vncev zippy storepasswd + install_OSX: OSXvnc-server cp OSXvnc-server storepasswd ../OSXvnc/build/OSXvnc.app/Contents/MacOS diff --git a/cvs_update_anonymously b/cvs_update_anonymously new file mode 100644 index 0000000..f94b616 --- /dev/null +++ b/cvs_update_anonymously @@ -0,0 +1 @@ +cvs -z3 -d :pserver:anonymous@cvs.libvncserver.sf.net:/cvsroot/libvncserver update @@ -211,7 +211,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) unsigned int maxFnameLen; FILE* fd; Bool performSubstitutions = FALSE; - char str[256]; + char str[256+32]; #ifndef WIN32 struct passwd *user = getpwuid(getuid()); #endif @@ -552,6 +552,8 @@ int main(int argc,char *argv[]) for(i=argc-1;i>0;i--) #ifdef LOCAL_CONTROL if(i<argc-1 && !strcmp(argv[i],"-toggleviewonly")) { + if(strlen(argv[i+1])>1022) + argv[i+1][1022]=0; sprintf(message,"t%s",argv[i+1]); send_message(&single_instance,message); exit(0); @@ -562,6 +564,8 @@ int main(int argc,char *argv[]) } else #ifdef BACKCHANNEL if(i<argc-1 && !strcmp(argv[i],"-backchannel")) { + if(strlen(argv[i+1])>1022) + argv[i+1][1022]=0; sprintf(message,"b%s",argv[i+1]); send_message(&single_instance,message); exit(0); diff --git a/pnmshow24.c b/pnmshow24.c index 3978f00..e096c7f 100644 --- a/pnmshow24.c +++ b/pnmshow24.c @@ -16,7 +16,7 @@ int main(int argc,char** argv) { FILE* in=stdin; int j,width,height,paddedWidth; - unsigned char buffer[1024]; + char buffer[1024]; rfbScreenInfoPtr rfbScreen; if(argc>1) { @@ -67,10 +67,10 @@ void output(rfbScreenInfoPtr s,char* line) void dokey(Bool down,KeySym k,rfbClientPtr cl) { - char buffer[1024]; + char buffer[1024+32]; sprintf(buffer,"%s: %s (0x%x)", - down?"down":"up",keys[k&0x3ff]?keys[k&0x3ff]:"",k); + down?"down":"up",keys[k&0x3ff]?keys[k&0x3ff]:"",(unsigned int)k); output(cl->screen,buffer); } @@ -84,17 +84,18 @@ void doptr(int buttonMask,int x,int y,rfbClientPtr cl) } -void newclient(rfbClientPtr cl) +enum rfbNewClientAction newclient(rfbClientPtr cl) { char buffer[1024]; struct sockaddr_in addr; - int len=sizeof(addr),ip; + unsigned int len=sizeof(addr),ip; - getpeername(cl->sock,&addr,&len); + getpeername(cl->sock,(struct sockaddr*)&addr,&len); ip=ntohl(addr.sin_addr.s_addr); sprintf(buffer,"Client connected from ip %d.%d.%d.%d", (ip>>24)&0xff,(ip>>16)&0xff,(ip>>8)&0xff,ip&0xff); output(cl->screen,buffer); + return RFB_CLIENT_ACCEPT; } int main(int argc,char** argv) @@ -102,7 +103,7 @@ int main(int argc,char** argv) rfbScreenInfoPtr s=rfbGetScreen(&argc,argv,640,480,8,1,1); s->colourMap.is16=FALSE; s->colourMap.count=2; - s->colourMap.data.bytes="\xd0\xd0\xd0\x30\x01\xe0"; + s->colourMap.data.bytes=(unsigned char*)"\xd0\xd0\xd0\x30\x01\xe0"; s->rfbServerFormat.trueColour=FALSE; s->frameBuffer=f; s->kbdAddEvent=dokey; @@ -4,6 +4,7 @@ */ #include <X11/Xlib.h> +#include <X11/Xutil.h> #include <X11/keysym.h> #include <X11/extensions/XTest.h> #ifndef NO_SHM @@ -338,6 +339,8 @@ int main(int argc,char** argv) for(i=argc-1;i>0;i--) #ifdef LOCAL_CONTROL if(i<argc-1 && !strcmp(argv[i],"-toggleviewonly")) { + if(strlen(argv[i+1])>1022) + argv[i+1][1022]=0; sprintf(message,"t%s",argv[i+1]); send_message(&single_instance,message); exit(0); @@ -348,6 +351,8 @@ int main(int argc,char** argv) } else #ifdef BACKCHANNEL if(i<argc-1 && !strcmp(argv[i],"-backchannel")) { + if(strlen(argv[i+1])>1022) + argv[i+1][1022]=0; sprintf(message,"b%s",argv[i+1]); send_message(&single_instance,message); exit(0); @@ -417,7 +422,7 @@ int main(int argc,char** argv) for(i=0;i<256;i++) color[i].pixel=i; XQueryColors(dpy,DefaultColormap(dpy,xscreen),color,256); - screen->colourMap.data.shorts = (short*)malloc(3*sizeof(short)*screen->colourMap.count); + screen->colourMap.data.shorts = (unsigned short*)malloc(3*sizeof(short)*screen->colourMap.count); for(i=0;i<screen->colourMap.count;i++) { screen->colourMap.data.shorts[i*3+0] = color[i].red; screen->colourMap.data.shorts[i*3+1] = color[i].green; @@ -509,7 +514,7 @@ int main(int argc,char** argv) rfbScreenCleanup(screen); XFree(dpy); #ifndef NO_SHM - XShmDetach(dpy,framebufferImage); + XShmDetach(dpy,&shminfo); #endif exit(0); } @@ -21,7 +21,6 @@ void on_key_press (Bool down,KeySym key,rfbClientPtr cl); int main (int argc, char **argv) { - int i; rfbScreenInfoPtr server; rfbProcessSizeArguments(&maxx,&maxy,&bpp,&argc,argv); @@ -109,7 +108,7 @@ void draw_primary_colours_generic_fast(rfbScreenInfoPtr s,int x1,int y1,int x2,i void draw_primary_colours_generic_ultrafast(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2) { rfbPixelFormat f=s->rfbServerFormat; - int i,j,y3=(y1*2+y2)/3,y4=(y1+y2*2)/3; + int y3=(y1*2+y2)/3,y4=(y1+y2*2)/3; /* fill rectangles */ rfbFillRect(s,x1,y1,x2,y3,f.redMax<<f.redShift); rfbFillRect(s,x1,y3,x2,y4,f.greenMax<<f.greenShift); |