X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fsi%2Fsrc%2Fsi95%2Fsigetadd.c;h=cf2feea45c7e078136eec16d4deeed9c85d7070c;hb=cc314e0c526a0ed0ce9295e490b3f2bb29c3332c;hp=5cf379586167f41c2e38c55eeb8ac5830f5df6f0;hpb=ec88d3c0563eeb6ae5f73427edb0b3c4d7acf299;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/si/src/si95/sigetadd.c b/src/rmr/si/src/si95/sigetadd.c index 5cf3795..cf2feea 100644 --- a/src/rmr/si/src/si95/sigetadd.c +++ b/src/rmr/si/src/si95/sigetadd.c @@ -24,7 +24,8 @@ * Mnemonic: SIgetaddr * Abstract: This routine will get the address of the first listening * block on the tp list and return it in ASCII format to the -* caller. +* caller. The dest buffer is assumed to be at least 256 bytes +* long. * Parms: gptr - Pointer to the global information block * buf - Pointer to the buffer to hold the ascii string * Returns: NI_OK if block found, NI_ERROR if no listen block exists @@ -33,23 +34,22 @@ * ****************************************************************************** */ -#include "sisetup.h" // get the standard include stuff +#include "sisetup.h" // get the standard include stuff extern int SIgetaddr( struct ginfo_blk *gptr, char *buf ) { - struct tp_blk *tpptr; // Pointer into tp list - int status = SI_ERROR; // return status - char *ibuf; // SIaddr now points us at a string, rather than filling ours + struct tp_blk *tpptr; // Pointer into tp list + int status = SI_ERROR; // return status + char *ibuf; // SIaddr now points us at a string, rather than filling ours - for( tpptr = gptr->tplist; tpptr != NULL && !(tpptr->flags & TPF_LISTENFD); - tpptr = tpptr->next ); + for( tpptr = gptr->tplist; tpptr != NULL && !(tpptr->flags & TPF_LISTENFD); tpptr = tpptr->next ); - if( tpptr != NULL ) - { - SIaddress( tpptr->addr, (void *) &ibuf, AC_TODOT ); // convert to dot fmt - strcpy( buf, ibuf ); // copy into caller's buffer + if( tpptr != NULL ) + { + SIaddress( tpptr->addr, (void *) &ibuf, AC_TODOT ); // convert to dot fmt + strncpy( buf, ibuf, 256 ); // copy into caller's buffer free( ibuf ); - status = SI_OK; // ok status for return - } + status = SI_OK; // ok status for return + } - return status; -} + return status; +}