diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-08-09 17:37:02 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-08-09 17:37:02 +0200 |
commit | 760063ab57aa42ea82f1bf5c9177c0cde206aeee (patch) | |
tree | 611a4d90579e9e5024540e2af85e918df0257c88 /sys/src/cmd/cwfs/malloc.c | |
parent | 3472f91129a7a594b356f9a22af2a8176f6e4b1c (diff) |
cwfs: fix 32bit multiplication overflows for allocation sizes (thanks kenji okomoto)
Diffstat (limited to 'sys/src/cmd/cwfs/malloc.c')
-rw-r--r-- | sys/src/cmd/cwfs/malloc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/src/cmd/cwfs/malloc.c b/sys/src/cmd/cwfs/malloc.c index 165599623..25ae33b5f 100644 --- a/sys/src/cmd/cwfs/malloc.c +++ b/sys/src/cmd/cwfs/malloc.c @@ -100,15 +100,15 @@ iobufinit(void) nhiob++; if(chatty) print("\t%ud buffers; %ud hashes\n", niob, nhiob); - hiob = ialloc(nhiob * sizeof(Hiob), 0); + hiob = ialloc((uintptr)nhiob * sizeof(Hiob), 0); hp = hiob; for(i=0; i<nhiob; i++) { lock(hp); unlock(hp); hp++; } - p = ialloc(niob * sizeof(Iobuf), 0); - xiop = ialloc(niob * RBUFSIZE, 0); + p = ialloc((uintptr)niob * sizeof(Iobuf), 0); + xiop = ialloc((uintptr)niob * RBUFSIZE, 0); hp = hiob; for(i=0; i < niob; i++) { qlock(p); |