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

Changeset b83c5e4 in mainline


Ignore:
Timestamp:
2023-01-18T20:15:42Z (2 weeks ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
eb630cf
Parents:
3e7e226
Message:

Make sure we don't call memcpy() with NULL pointer

The standard requires the pointer is valid even when size is 0,
and this triggers diagnostics in some checkers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/rtld/rtld.c

    r3e7e226 rb83c5e4  
    187187                assert(((uintptr_t) dtv[m->id]) % m->tls_align == 0);
    188188
    189                 memcpy(dtv[m->id], m->tdata, m->tdata_size);
     189                if (m->tdata)
     190                        memcpy(dtv[m->id], m->tdata, m->tdata_size);
     191
    190192                memset(dtv[m->id] + m->tdata_size, 0, m->tbss_size);
    191193        }
Note: See TracChangeset for help on using the changeset viewer.