Changeset 1a60fee in mainline


Ignore:
Timestamp:
2008-05-15T18:28:50Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4452366
Parents:
e1f51712
Message:

Do not attempt to malloc() zero bytes of memory during VFS_READ at end of file.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/sysipc.c

    re1f51712 r1a60fee  
    244244                        size_t max_size = IPC_GET_ARG2(*olddata);
    245245                        size_t size = IPC_GET_ARG2(answer->data);
    246                         if (size <= max_size) {
     246                        if (size && size <= max_size) {
    247247                                /*
    248248                                 * Copy the destination VA so that this piece of
     
    259259                                        answer->buffer = NULL;
    260260                                }
     261                        } else if (!size) {
     262                                IPC_SET_RETVAL(answer->data, EOK);
    261263                        } else {
    262264                                IPC_SET_RETVAL(answer->data, ELIMIT);
  • uspace/app/tester/vfs/vfs1.c

    re1f51712 r1a60fee  
    8787        char buf[10];
    8888
    89         cnt = read(fd0, buf, sizeof(buf));
    90         if (cnt < 0)
    91                 return "read() failed.\n";
    92 
    93         if (!quiet)
    94                 printf("read %d bytes: \"%.*s\", fd=%d\n", cnt, cnt, buf, fd0);
     89        while ((cnt = read(fd0, buf, sizeof(buf)))) {
     90                if (cnt < 0)
     91                        return "read() failed.\n";
     92                if (!quiet)
     93                        printf("read %d bytes: \"%.*s\", fd=%d\n", cnt, cnt,
     94                            buf, fd0);
     95        }
    9596
    9697        close(fd0);
Note: See TracChangeset for help on using the changeset viewer.