quectel-cm: fix build with gcc14

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen
2025-05-04 19:12:21 +08:00
parent fa67289bfd
commit f8c045c9fe
2 changed files with 30 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=quectel-cm
PKG_VERSION:=1.6.5
PKG_RELEASE:=3
PKG_RELEASE:=4
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

View File

@@ -0,0 +1,29 @@
--- a/quectel-qrtr-proxy.c
+++ b/quectel-qrtr-proxy.c
@@ -547,7 +547,7 @@ static int recv_qmi_from_client(PQCQMIMS
}
else if (le16toh(pQMI->CTLMsg.QMICTLMsgHdr.QMICTLType) == QMICTL_GET_CLIENT_ID_REQ) {
uint8_t QMIType = pQMI->CTLMsg.GetClientIdReq.QMIType;
- PQCQMIMSG pRsp = (PQCQMIMSG)malloc(256);
+ PQCQMIMSG pRsp = (PQCQMIMSG)malloc(sizeof(*pRsp));
if (pRsp) {
uint8_t ClientId = 0;
@@ -581,7 +581,7 @@ static int recv_qmi_from_client(PQCQMIMS
}
}
else if (le16toh(pQMI->CTLMsg.QMICTLMsgHdr.QMICTLType) == QMICTL_RELEASE_CLIENT_ID_REQ) {
- PQCQMIMSG pRsp = (PQCQMIMSG)malloc(256);
+ PQCQMIMSG pRsp = (PQCQMIMSG)malloc(sizeof(*pRsp));
release_qrtr_client_id(qrtr_con, pQMI->CTLMsg.ReleaseClientIdReq.QMIType, pQMI->CTLMsg.ReleaseClientIdReq.ClientId);
if (pRsp) {
@@ -610,7 +610,7 @@ static int recv_qmi_from_client(PQCQMIMS
}
}
else if (le16toh(pQMI->CTLMsg.QMICTLMsgHdr.QMICTLType) == QMICTL_GET_VERSION_REQ) {
- PQCQMIMSG pRsp = (PQCQMIMSG)malloc(256);
+ PQCQMIMSG pRsp = (PQCQMIMSG)malloc(sizeof(*pRsp));
if (pRsp) {
pRsp->QMIHdr.IFType = USB_CTL_MSG_TYPE_QMI;