1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtspcd: Cov 89547, 175089

This commit is contained in:
Peter Howkins 2018-04-04 20:37:13 +01:00
parent c12c130ece
commit 9ef3b9ec68

View file

@ -507,6 +507,7 @@ int Client_Register(protocol_request_ptr prot)
char *spc_prefix = "/.SPC_"; char *spc_prefix = "/.SPC_";
char *spc_suffix; char *spc_suffix;
char tmpnam_buf[L_tmpnam + 1]; char tmpnam_buf[L_tmpnam + 1];
size_t buffsize;
print_protocol_request((XeString)"--> REGISTER", prot); print_protocol_request((XeString)"--> REGISTER", prot);
prot->channel=0; prot->channel=0;
@ -563,10 +564,10 @@ int Client_Register(protocol_request_ptr prot)
spc_suffix = basename(tmpnam_buf); /* Don't free result - not alloc'd! */ spc_suffix = basename(tmpnam_buf); /* Don't free result - not alloc'd! */
/* Allocate space for tmppath, spc_prefix, and spc_suffix. */ /* Allocate space for tmppath, spc_prefix, and spc_suffix. */
tmpfile = (char *)malloc((strlen(tmppath) + strlen(spc_prefix) + buffsize = strlen(tmppath) + strlen(spc_prefix) + strlen(spc_suffix) + 1;
strlen(spc_suffix) + 1) * sizeof(char)); tmpfile = (char *)malloc(buffsize);
if(tmpfile) { if(tmpfile) {
snprintf(tmpfile, sizeof(tmpfile), "%s%s%s", tmppath, spc_prefix, spc_suffix); snprintf(tmpfile, buffsize, "%s%s%s", tmppath, spc_prefix, spc_suffix);
} }
} }
else { else {
@ -653,8 +654,10 @@ int Client_Register(protocol_request_ptr prot)
SPC_LocalHostinfo()); SPC_LocalHostinfo());
prot=SPC_Filter_Connection(client_connection, NULL, REGISTER, TRUE); prot=SPC_Filter_Connection(client_connection, NULL, REGISTER, TRUE);
if(prot==SPC_ERROR) if(prot==SPC_ERROR) {
XeFree(tmpfile);
return(SPC_ERROR); return(SPC_ERROR);
}
sprintf(buffer, (XeString)"--> REGISTER (%s)", netfile); sprintf(buffer, (XeString)"--> REGISTER (%s)", netfile);
print_protocol_request(buffer, prot); print_protocol_request(buffer, prot);
SPC_Free_Protocol_Ptr(prot); SPC_Free_Protocol_Ptr(prot);