Compilation problems with parameter conversions

netsniper

Member
Joined
Aug 21, 2003
Messages
12
I am getting some compiler errors and I assume that this is because of the .NET managed code. Im not sure though, and if so, maybe I can disable it somehow. Please check it out below and see the error:

(386): error C2664: strlen : cannot convert parameter 1 from unsigned char * to const char *

memcpy(&buf[2036], sc, strlen(sc));

Any ideas?

Netsniper
 
Forgot to ask how sc is declared as well?
if it is something like
Code:
unsigned char* sc;
then you will need to cast it to a signed char...
Code:
memcpy(&buf[2036], sc, strlen((char *)sc));
however this could result in the loss of data, is there a reason why one is declared unsigned and the other signed? Also it may help if you give more detail on what you are trying to do - there may be another reason (although admittedly C++ isnt my strong point)
 
It is only the first parameter being passed to memcpy that is the problem, not the third. Basically, I am quite new to programming (less than a year of seriously applied experience with VB .NET, Java, MS VC++). I never really learned C, since I am learning Java now - I know - shoot me. Anyways, I am trying to compile some security related code having to do with recent MS vulnerabilities. I could link you to a copy of the code if you like here:

http://packetstorm.linuxsecurity.com/0405-exploits/HOD-ms04011-lsasrv-expl.c

Netsniper
 
Back
Top