1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0022953: strcat expects null-terminated destination string

This commit is contained in:
Pawel, DBV
2012-02-17 07:58:20 +00:00
committed by bugmaster
parent a0ed63ac93
commit f78c0415f7
7 changed files with 0 additions and 390 deletions

View File

@@ -7,8 +7,6 @@ OSD_Function.cxx
OSD_Getkey.c
OSD_Function.hxx
OSD_ErrorList.hxx
ethernet.h-sgi
ethernet.h-dec
OSD_WNT.cxx
OSD_WNT_1.cxx
OSD_WNT.hxx

View File

@@ -41,10 +41,6 @@ raises ConstructionError, NullObject, OSDError
---Purpose: Returns Internet address of current host.
---Level: Advanced
EthernetAddress (me : in out) returns AsciiString is static;
---Purpose: Returns Ethernet address of current host.
---Level: Advanced
MachineType (me : in out) returns OEMType is static;
---Purpose: Returns type of current machine.
---Level: Advanced

View File

@@ -165,34 +165,6 @@ TCollection_AsciiString OSD_Host::InternetAddress(){
return(result);
}
// =========================================================================
// Adresse ethernet: Disponible uniquement (et de facon fiable) sur ========
// DIGITAL (DEC OSF1) et SILICON (IRIX) ====================================
// =========================================================================
#if defined(__osf__) || defined(DECOSF1)
#include "ethernet.h-dec"
#elif defined(__sgi) || defined(IRIX)
#include "ethernet.h-sgi"
#else
static TCollection_AsciiString Ethernet(){
struct utsname info;
uname(&info);
char noaddress[100];
strcat(noaddress,"NO-ETHERNET-ADDRESS-AVAILABLE-ON-");
TCollection_AsciiString result(strcat(noaddress,info.sysname));
return (result);
}
#endif
// =========================================================================
TCollection_AsciiString OSD_Host::EthernetAddress(){
TCollection_AsciiString result;
result = Ethernet();
return (result);
}
// =========================================================================
OSD_OEMType OSD_Host::MachineType(){
struct utsname info;
@@ -250,7 +222,6 @@ static BOOL fInit = FALSE;
static TCollection_AsciiString hostName;
static TCollection_AsciiString version;
static TCollection_AsciiString interAddr;
static TCollection_AsciiString etherAddr;
static Standard_Integer memSize;
OSD_Host :: OSD_Host () {
@@ -359,12 +330,6 @@ TCollection_AsciiString OSD_Host :: InternetAddress () {
} // end OSD_Host :: InternetAddress
TCollection_AsciiString OSD_Host :: EthernetAddress () {
return etherAddr;
} // end EthernatAddress
OSD_OEMType OSD_Host :: MachineType () {
return OSD_PC;

View File

@@ -1,70 +0,0 @@
#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif
extern "C" { int socket ( int addr, int type, int protocol ); }
/* phn:20/4/94:delete:begin:because not the same signature in </sys/ioctl.h> */
/* extern "C" { int ioctl ( int d, unsigned long request, char *argp);} */
/* phn:20/4/94:delete:end:because not the same signature in </sys/ioctl.h> */
extern "C" { int close ( int filedes ); }
Standard_CString Ethernet() {
struct ifdevea devea;
Standard_CString result;
static char *ether_devices[] = {
"qe0",
"se0",
"ln0",
"de0",
"ni0",
NULL
};
char name[32];
long *eth;
int e[6]; // For byte to int conversions
int sock, i;
/* we need a socket */
sock = socket (AF_INET, SOCK_DGRAM, 0);
if (sock < 0) // Error : "Socket for Ethernet device localisation"
return(result);
/* loop until we find a device or we error out */
for (i = 0; ether_devices[i] != NULL; i++) {
/* setup the device name */
strcpy (&devea.ifr_name[0], ether_devices[i]);
/* read the interface address */
/* phn:20/4/94:update:begin:because not the same signature in </sys/ioctl.h> */
if (ioctl (sock, SIOCRPHYSADDR, &devea) < 0) { // error ?
/* if (ioctl (sock, (unsigned long)SIOCRPHYSADDR, (char*) &devea) < 0) { */ // error ?
/* phn:20/4/94:update:end:because not the same signature in </sys/ioctl.h> */
if (errno == ENXIO) { // doesn't exist, try next device
continue;
} else { // unexpected error
//perror (&devea.ifr_name[0]);
return(result);
}
} else break; // found one, break out
} /* for ... */
close (sock);
if (ether_devices[i] == NULL) // Error : no Ethernet device
return(result);
// unsigned char to int conversions
e[0] = (unsigned char)devea.default_pa[0];
e[1] = (unsigned char)devea.default_pa[1];
e[2] = (unsigned char)devea.default_pa[2];
e[3] = (unsigned char)devea.default_pa[3];
e[4] = (unsigned char)devea.default_pa[4];
e[5] = (unsigned char)devea.default_pa[5];
sprintf(name,"%x:%x:%x:%x:%x:%x",e[0],e[1],e[2],e[3],e[4],e[5]);
result = name;
return(result);
}

View File

@@ -1,43 +0,0 @@
#include <net/if.h>
#include <net/raw.h>
Standard_CString Ethernet() {
Standard_CString result;
static char *ether_devices[]={
"ec0",
"enp0",
"et0",
"fxp0",
NULL
};
int sock,i;
int e[6];
struct ifreq ifreq;
static char buffer[16];
sock = socket(AF_RAW,SOCK_RAW,RAWPROTO_DRAIN);
if (sock < 0) /* Error : "drain_open:could not open socket" */
return(result);
for (i=0; ether_devices[i] != NULL; i++){
strcpy(ifreq.ifr_name, ether_devices[i]); /* Puts name */
if (ioctl(sock, SIOCGIFADDR, (char *) &ifreq) < 0)
if (errno == ENXIO) continue;
else /* Error : "drain:getmyaddr:cannot get raw address" */
return(result);
}
e[0] = (unsigned char)ifreq.ifr_addr.sa_data[0];
e[1] = (unsigned char)ifreq.ifr_addr.sa_data[1];
e[2] = (unsigned char)ifreq.ifr_addr.sa_data[2];
e[3] = (unsigned char)ifreq.ifr_addr.sa_data[3];
e[4] = (unsigned char)ifreq.ifr_addr.sa_data[4];
e[5] = (unsigned char)ifreq.ifr_addr.sa_data[5];
sprintf(buffer,"%x:%x:%x:%x:%x:%x", e[0],e[1],e[2],e[3],e[4],e[5]);
close(sock);
result = buffer;
return(result);
}