I get this message when, I think, I get some rong string name.

-I am actually in process on making a http server.
-I have directry like this:

C:\website

-Now, I put all the files for in server in this directry.

-The user enters the web address like this:

http://localhost/woo/index.html

-The user can see the file...So far, it works fine

Now, When the use enter an address like this:

http://localhost/woo

The server should list the directories and files in the "woo" folder..should not it? But I get the error message saying
"Debug assertion failed"

So here the code that I am using to handle the data recieved from te client:

Code:
                       d=recv(wparam,aa,1000,0);
						abc(aa);
                        p=aa + 4;   //I get the assertion error message on this line 
                        e=0;
                        while(*p!=32)
                        {
                                if (*p=='/')
                                {
                                        buf[e]='\\'; 
                                }
                                else 
                                        buf[e]=*p;
                                if(buf[e]=='.')
									fn=1;
                                p++;
                                e++;
                        }

	        buf[e] = 0;

                        if (strlen(buf)==1)
                                strcpy(filename,"c:\\website\\woo\\index.html");
                        else
                        {
                                strcpy(filename,"c:\\website");
                                strcat(filename,buf);

                                if(fn==0)
                                        strcat(filename,"main.html");
                        }
                                abc(filename);
                        
                        fp=fopen(filename,"rb");
                        fseek(fp,0,2);
                        size=ftell(fp);
 
                        strcpy(header,"HTTP/1.0 200 ok \r\n");
 
                        sprintf(bb,"Content-Length:%ld\r\n\r\n",size);
                        strcat(header,bb);
                        send(wparam,header,strlen(header),0);
                        pp= (char*)GlobalAlloc(GPTR, size);
                        fseek(fp,0,0);
                        fread(pp,size,1,fp);
                        send(wparam,pp,size,0);
                        closesocket(wparam);
						GlobalFree(pp);
The directory listing on my folder "website" is:

-main.html
->woo
-index.html


Please help me find the solution for that or I will no longer be able to work on this http server