ae4a70 Introduce free_and_strndup and use it in bus-message.c

5 files Authored by Zbigniew Jędrzejewski-Szmek 4 years ago, Committed by Packit Service 4 years ago,
    Introduce free_and_strndup and use it in bus-message.c
    
    v2: fix error in free_and_strndup()
    
    When the orignal and copied message were the same, but shorter than specified
    length l, memory read past the end of the buffer would be performed. A test
    case is included: a string that had an embedded NUL ("q\0") is used to replace
    "q".
    
    v3: Fix one more bug in free_and_strndup and add tests.
    
    v4: Some style fixed based on review, one more use of free_and_replace, and
    make the tests more comprehensive.
    
    (cherry picked from commit 7f546026abbdc56c453a577e52d57159458c3e9c)
    
    Resolves: #1635428
    
    patch_name: 0026-Introduce-free_and_strndup-and-use-it-in-bus-message.patch
    present_in_specfile: true
    location_in_specfile: 26
    squash_commits: true
    
        
file modified
+27 -1
file modified
+1 -0
file modified
+62 -0