Skip to content
  • Samanta Navarro's avatar
    db: fix installed db writing with long names · 41a6e4c2
    Samanta Navarro authored and Timo Teräs's avatar Timo Teräs committed
    Packages containing files with path names longer than 1024 characters
    cannot fit into the buffer which is used to write "installed" database.
    This leads to bbuf being APK_BLOB_NULL in apk_db_write_fdb because
    apk_blob_push_blob notices the condition and correctly handles it.
    
    The problem occurs when arguments to apk_ostream_write are manually
    calculated by pointer arithmetics. Since bbuf.ptr is NULL in such a
    case, bbuf.ptr - buf leads to a huge size value while buf still points
    into the stack.
    
    fixes #10751
    
    [TT: minor edit to commit and abbreviating the commit message]
    41a6e4c2