kopia lustrzana https://gitlab.com/sane-project/backends
pixma: Use snprint instead of sprintf to avoid buffer overflow.
rodzic
a9ad50fe56
commit
01a041c02c
|
@ -70,7 +70,7 @@
|
||||||
#define PIXMA_STATUS_FAILED 0x1515
|
#define PIXMA_STATUS_FAILED 0x1515
|
||||||
#define PIXMA_STATUS_BUSY 0x1414
|
#define PIXMA_STATUS_BUSY 0x1414
|
||||||
|
|
||||||
#define PIXMA_MAX_ID_LEN 30
|
#define PIXMA_MAX_ID_LEN 40
|
||||||
|
|
||||||
/* These may have been defined elsewhere */
|
/* These may have been defined elsewhere */
|
||||||
#ifndef MIN
|
#ifndef MIN
|
||||||
|
|
|
@ -132,7 +132,7 @@ attach_bjnp (SANE_String_Const devname,
|
||||||
return SANE_STATUS_NO_MEM;
|
return SANE_STATUS_NO_MEM;
|
||||||
|
|
||||||
si->cfg = cfg;
|
si->cfg = cfg;
|
||||||
sprintf(si->serial, "%s_%s", cfg->model, serial);
|
snprintf(si->serial, sizeof(si->serial), "%s_%s", cfg->model, serial);
|
||||||
si -> interface = INT_BJNP;
|
si -> interface = INT_BJNP;
|
||||||
si->next = first_scanner;
|
si->next = first_scanner;
|
||||||
first_scanner = si;
|
first_scanner = si;
|
||||||
|
@ -188,7 +188,7 @@ u16tohex (uint16_t x, char *str)
|
||||||
static void
|
static void
|
||||||
read_serial_number (scanner_info_t * si)
|
read_serial_number (scanner_info_t * si)
|
||||||
{
|
{
|
||||||
uint8_t unicode[2 * (PIXMA_MAX_ID_LEN - 9) + 2];
|
uint8_t unicode[2 * (PIXMA_MAX_ID_LEN - 9) + 2]; // 9 = size of VID + PID + "_"
|
||||||
uint8_t ddesc[18];
|
uint8_t ddesc[18];
|
||||||
int iSerialNumber;
|
int iSerialNumber;
|
||||||
SANE_Int usb;
|
SANE_Int usb;
|
||||||
|
|
Ładowanie…
Reference in New Issue