Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 3385dd3 in mainline


Ignore:
Timestamp:
2014-12-11T11:58:23Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
b336613f
Parents:
f42adef
Message:

klog: Read entry length from a possibly unaligned address safely

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/klog/klog.c

    rf42adef r3385dd3  
    5353#define NAME       "klog"
    5454
     55typedef size_t __attribute__ ((aligned(1))) unaligned_size_t;
     56
    5557typedef struct {
    5658        size_t entry_len;
     
    109111        size_t offset = 0;
    110112        while (offset < len) {
    111                 size_t entry_len = *((size_t *) (buffer + offset));
     113                size_t entry_len = *((unaligned_size_t *) (buffer + offset));
    112114               
    113115                if (offset + entry_len > len || entry_len < sizeof(log_entry_t))
Note: See TracChangeset for help on using the changeset viewer.