mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-30 16:51:41 +00:00
Use a size_t for variables that need to hold buffer lengths.
This commit is contained in:
parent
c7185249d7
commit
83c6192294
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118164
@ -57,6 +57,7 @@
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../scspd/scsp_msg.h"
|
||||
#include "../scspd/scsp_if.h"
|
||||
|
@ -182,7 +182,7 @@ atmarp_is_server(aip)
|
||||
Atmarp_intf *aip;
|
||||
{
|
||||
int rc;
|
||||
int buf_len = sizeof(struct air_asrv_rsp);
|
||||
size_t buf_len;
|
||||
struct atminfreq air;
|
||||
struct air_asrv_rsp *asrv_info;
|
||||
|
||||
@ -191,8 +191,8 @@ atmarp_is_server(aip)
|
||||
*/
|
||||
strcpy(air.air_int_intf, aip->ai_intf);
|
||||
air.air_opcode = AIOCS_INF_ASV;
|
||||
buf_len = do_info_ioctl(&air, buf_len);
|
||||
if (buf_len < 0)
|
||||
buf_len = do_info_ioctl(&air, sizeof(struct air_asrv_rsp));
|
||||
if ((ssize_t)buf_len == -1)
|
||||
return(0);
|
||||
|
||||
/*
|
||||
@ -222,7 +222,8 @@ int
|
||||
atmarp_if_ready(aip)
|
||||
Atmarp_intf *aip;
|
||||
{
|
||||
int i, len, mtu, rc, sel;
|
||||
int i, mtu, rc, sel;
|
||||
size_t len;
|
||||
Atmarp *aap = (Atmarp *)0;
|
||||
struct atminfreq air;
|
||||
struct air_netif_rsp *netif_rsp = (struct air_netif_rsp *)0;
|
||||
@ -239,9 +240,8 @@ atmarp_if_ready(aip)
|
||||
air.air_opcode = AIOCS_INF_NIF;
|
||||
strcpy(air.air_netif_intf, aip->ai_intf);
|
||||
len = do_info_ioctl(&air, sizeof(struct air_netif_rsp));
|
||||
if (len <= 0) {
|
||||
if ((ssize_t)len == -1)
|
||||
goto if_ready_fail;
|
||||
}
|
||||
netif_rsp = (struct air_netif_rsp *)air.air_buf_addr;
|
||||
|
||||
ip_addr = (struct sockaddr_in *)&netif_rsp->anp_proto_addr;
|
||||
@ -276,9 +276,8 @@ atmarp_if_ready(aip)
|
||||
air.air_opcode = AIOCS_INF_INT;
|
||||
strcpy(air.air_int_intf, netif_rsp->anp_phy_intf);
|
||||
len = do_info_ioctl(&air, sizeof(struct air_int_rsp));
|
||||
if (len <= 0) {
|
||||
if ((ssize_t)len == -1)
|
||||
goto if_ready_fail;
|
||||
}
|
||||
intf_rsp = (struct air_int_rsp *)air.air_buf_addr;
|
||||
|
||||
/*
|
||||
@ -551,7 +550,8 @@ atmarp_update_kernel(aap)
|
||||
void
|
||||
atmarp_get_updated_cache()
|
||||
{
|
||||
int i, len, rc;
|
||||
int i, rc;
|
||||
size_t len;
|
||||
struct atminfreq air;
|
||||
struct air_arp_rsp *cp;
|
||||
struct sockaddr_in *ipp;
|
||||
@ -574,9 +574,8 @@ atmarp_get_updated_cache()
|
||||
* Issue an ATMARP information request IOCTL
|
||||
*/
|
||||
len = do_info_ioctl(&air, sizeof(struct air_arp_rsp) * 200);
|
||||
if (len < 0) {
|
||||
if ((ssize_t)len == -1)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear marks on all our cache entries
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <libatm.h>
|
||||
#include <paths.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
|
@ -193,7 +193,7 @@ scsp_is_atmarp_server(netif)
|
||||
char *netif;
|
||||
{
|
||||
int rc;
|
||||
int buf_len = sizeof(struct air_asrv_rsp);
|
||||
size_t buf_len;
|
||||
struct atminfreq air;
|
||||
struct air_asrv_rsp *asrv_info;
|
||||
|
||||
@ -202,8 +202,8 @@ scsp_is_atmarp_server(netif)
|
||||
*/
|
||||
strcpy(air.air_int_intf, netif);
|
||||
air.air_opcode = AIOCS_INF_ASV;
|
||||
buf_len = do_info_ioctl(&air, buf_len);
|
||||
if (buf_len < 0)
|
||||
buf_len = do_info_ioctl(&air, sizeof(struct air_asrv_rsp));
|
||||
if ((ssize_t)buf_len == -1)
|
||||
return(0);
|
||||
|
||||
/*
|
||||
@ -678,7 +678,8 @@ int
|
||||
scsp_get_server_info(ssp)
|
||||
Scsp_server *ssp;
|
||||
{
|
||||
int i, len, mtu, rc, sel;
|
||||
int i, mtu, rc, sel;
|
||||
size_t len;
|
||||
struct atminfreq air;
|
||||
struct air_netif_rsp *netif_rsp = (struct air_netif_rsp *)0;
|
||||
struct air_int_rsp *intf_rsp = (struct air_int_rsp *)0;
|
||||
@ -702,7 +703,7 @@ scsp_get_server_info(ssp)
|
||||
air.air_opcode = AIOCS_INF_NIF;
|
||||
strcpy(air.air_netif_intf, ssp->ss_intf);
|
||||
len = do_info_ioctl(&air, sizeof(struct air_netif_rsp));
|
||||
if (len <= 0) {
|
||||
if ((ssize_t)len == -1 || len == 0) {
|
||||
rc = EIO;
|
||||
goto server_info_done;
|
||||
}
|
||||
@ -732,7 +733,7 @@ scsp_get_server_info(ssp)
|
||||
air.air_opcode = AIOCS_INF_INT;
|
||||
strcpy(air.air_int_intf, netif_rsp->anp_phy_intf);
|
||||
len = do_info_ioctl(&air, sizeof(struct air_int_rsp));
|
||||
if (len <= 0) {
|
||||
if ((ssize_t)len == -1 || len == 0) {
|
||||
rc = EIO;
|
||||
goto server_info_done;
|
||||
}
|
||||
@ -786,7 +787,7 @@ scsp_get_server_info(ssp)
|
||||
air.air_opcode = AIOCS_INF_CFG;
|
||||
strcpy(air.air_int_intf, netif_rsp->anp_phy_intf);
|
||||
len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp));
|
||||
if (len <= 0) {
|
||||
if ((ssize_t)len == -1 || len == 0) {
|
||||
rc = EIO;
|
||||
goto server_info_done;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user