implementing ProcessRequest and wants to copy data into buffer to return to the caller
The function signature is he following :
int ProcessRequest(HCST hCST, void *buffer, short tag, short status)
path name of the file is stored in char src [40]
;
You need this :
int ProcessRequest(int hCST, void *buffer, short tag, short status)
{
// stub function
static char test[] = "Test";
strcpy(buffer, test);
return 0;
}
...
char src [40];
...
ProcessRequest(myhCST, src, mytag, mystatus);
/* now src contains "Test" */
This code is very simple and unsafe because ProcessRequest
doesn't know the size of buffer
and hence may potentially overwrite past the end of buffer
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.