Fixed a buffer overflow caused by our R5 select() emulation.

Added missing uname() function which is needed for full R5 compatibility.
It seems that nearly all apps are working now. I could finally run Vision (BONE and R5), BeShare (quick test only), lynx, Net+, etc.
Apps that don't work: Mozilla for BONE, some ssh binary that I downloaded, Be's ftp when not in passive mode.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9098 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Waldemar Kornewald 2004-09-29 07:35:31 +00:00
parent 42605e58c3
commit 982115e516
2 changed files with 24 additions and 3 deletions

View File

@ -142,3 +142,23 @@ _EXPORT int getpassword(char * pwd, size_t length)
}
struct utsname {
char sysname[32];
char nodename[32];
char release[32];
char version[32];
char machine[32];
};
int uname(struct utsname *name);
_EXPORT int uname(struct utsname *name)
{
if(!name)
return B_ERROR;
strcpy(name->sysname, "BeOS");
strcpy(name->nodename, "trantor");
strcpy(name->release, "5.0");
strcpy(name->version, "1000009");
strcpy(name->machine, "BePC");
return B_OK;
}

View File

@ -146,16 +146,17 @@ _EXPORT int select(int nbits, struct fd_set * rbits,
case B_WOULD_BLOCK:
case B_TIMED_OUT: // logicly, 'n' should stay to 0 in this case...
n = 0;
// IMPORTANT: memcpy uses the old R5 fd_bits size (sizeof(unsigned) * 8)!
if (rbits) {
memcpy(rbits, &rss->rbits, sizeof(*rbits));
memcpy(rbits, &rss->rbits, sizeof(unsigned) * 8);
n += fd_set_count(rbits, nbits);
};
if (wbits) {
memcpy(wbits, &rss->wbits, sizeof(*wbits));
memcpy(wbits, &rss->wbits, sizeof(unsigned) * 8);
n += fd_set_count(wbits, nbits);
};
if (ebits) {
memcpy(ebits, &rss->ebits, sizeof(*ebits));
memcpy(ebits, &rss->ebits, sizeof(unsigned) * 8);
n += fd_set_count(ebits, nbits);
};
break;