Page 1 of 1

[ps2Client] problem when we load a irx file

Posted: Wed Jun 01, 2005 9:00 am
by Nippy
Hi,
in ps2client we can't load a file bigger than 65536 bytes so i made a patch :D

Index: ps2link.c
===================================================================
RCS file: /home/ps2cvs/ps2client/src/ps2link.c,v
retrieving revision 1.28
diff -r1.28 ps2link.c
313c313,314
< int result = -1, size = -1; char buffer[65536];
---
> int result = -1, size = -1;
> char *buffer;
314a316
> buffer = malloc(ntohl(request->size));
322,323c324,326
< return network_send(request_socket, buffer, size);
<
---
> result = network_send(request_socket, buffer, size);
> free(buffer);
> return result;

Posted: Wed Jun 01, 2005 9:15 am
by ooPo
This is during execiop, right?

Strange.

Thanks for the patch, though. :)

Posted: Wed Jun 01, 2005 9:52 pm
by Shazz
hello ooPo,

No, it's when you load an elf (execee) which load IRX bigger than 64Kb

cheers

Posted: Thu Jun 02, 2005 2:12 am
by ooPo
The reason I ask is that I was told the largest transfer to ever expect from ps2link would be 64k. I'm wondering if some part of ps2link may not be checking a buffer size somewhere and overflowing.

Posted: Thu Jun 02, 2005 5:58 am
by ooPo
Source in cvs has been updated. If a read or write is over 64k, it allocates a bigbuffer and uses that, otherwise it uses the same old buffer. This is to avoid a bunch of malloc/free calls when possible.

Thanks for pointing it out. :)