• Rusty Russell's avatar
    opt: fix opt_unregister. · 4f20b75c
    Rusty Russell authored
    Instead of memmoving N structs, we were memmoving N bytes.
    
    But why did the test pass then?  It was doing memmove(..., 1)
    instead of memmove(..., sizeof(struct opt_table)!
    
    Because the two structures were really similar; the main difference
    was the first entry, which points to the name.  But they were allocated
    consecutively, and Intel being little-endian, the only difference was
    the first byte!  Thus memmove(1) was enough to make it "work".
    
    Change two options in the test to be sufficiently different, and
    the bug shows up.
    Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
    4f20b75c
opt.c 6.83 KB