diff --git a/src/linux/qcom_usbnet/qcom_usbnet_main.c b/src/linux/qcom_usbnet/qcom_usbnet_main.c index 82b771d..434ac06 100644 --- a/src/linux/qcom_usbnet/qcom_usbnet_main.c +++ b/src/linux/qcom_usbnet/qcom_usbnet_main.c @@ -160,8 +160,7 @@ sGobiUSBNet *GobiAcquireDevice(char *mpKey, struct usbnet * pDev) } else { - sprintf(commonDevName,"%s:%d-%s", mpKey, pDev->udev->bus->busnum, pDev->udev->devpath); - commonDevName[254] = '\0'; + snprintf(commonDevName, sizeof(commonDevName), "%s:%d-%s", mpKey, pDev->udev->bus->busnum, pDev->udev->devpath); list_for_each_entry(pGobiDev, &DeviceListIdle, node) { @@ -2481,7 +2480,7 @@ static ssize_t debug_show(struct kobject *kobj, qmi_sys = (qmi_sys<<8) + logLvl; } } - return sprintf(buf, "%04x\n", qmi_sys); + return scnprintf(buf, PAGE_SIZE, "%04x\n", qmi_sys); } static ssize_t debug_store(struct kobject *kobj, @@ -2576,7 +2575,7 @@ static ssize_t gobiQMITimer_show(struct kobject *kobj, #ifdef TX_AGGR ctx = &pDevOnRecord->tx_aggr_ctx; if (ctx->timer_interval) - return sprintf(buf, "%llu\n", ctx->timer_interval / (u32)NSEC_PER_MSEC); + return scnprintf(buf, PAGE_SIZE, "%llu\n", ctx->timer_interval / (u32)NSEC_PER_MSEC); #endif } } @@ -3129,7 +3128,7 @@ static ssize_t GobiUSBprocRead(struct file *file, char __user *ubuf,size_t count if(*ppos > 0 || count < BUFSIZE) return 0; - len += sprintf(buf, "%d %ld ms\n", debug_g, gtimer/NSEC_PER_USEC); + len += scnprintf(buf, BUFSIZE, "%d %ld ms\n", debug_g, gtimer/NSEC_PER_USEC); if(copy_to_user(ubuf,buf,len)) return -EFAULT;