Skip to content

segfault in firmware writer #43

Description

@ka9q

fobos_fwloader -w fobos_usb_rx.img segfaults because of an erroneous calculation of a buffer size in fobos/fobos.c.

Here's the fix. I'm not submitting this as a PR because it's really trivial, and I already have a bigger PR pending to the same file (fobos.c) to implement raw mode.

in fobos_rx_write_firmware():

 result = FOBOS_ERR_OK;
 uint16_t xx_size = 1024;
  • uint16_t xx_count = (uint16_t)(file_size + xx_size - 1)/ xx_size;
  • uint16_t xx_count = (uint16_t)((file_size + xx_size - 1)/ xx_size);
    uint8_t * file_data = (uint8_t * )malloc(xx_count * xx_size);
    fseek(f, 0, SEEK_SET);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions