I think the problem is here (3 similar places):

    /* StringOne(2)/STRING/ASN_OCTET_STR/char(char)*/
    case ColumnMIBTableStringOne:
        var->val_len = strlen((const 
char*)m_pMIBTableTableDataMngrDataTerm->GetPtr(Stat, MIB_TABLE_STRING_ONE_ID, 
m_iMIBTableTableRow - 1));
        var->type = ASN_OCTET_STR;
        strcpy(((char*)var->val.string), ((const 
char*)m_pMIBTableTableDataMngrDataTerm->GetPtr(Stat, MIB_TABLE_STRING_ONE_ID, 
m_iMIBTableTableRow - 1)));
        iRetCode = SNMPERR_SUCCESS;    
    break;

Depending on the size if the storage underlying var->val.string you will
write wildly beyond the end of the string.

That you get the error you ae seeing is likely to be due to the fact
that dataFreeHook is located just after the default data buffer of the
variable_list structure.

The correct way to write the above code is:

    /* StringOne(2)/STRING/ASN_OCTET_STR/char(char)*/
    case ColumnMIBTableStringOne:
        snmp_set_var_typed_value(
            var, ASN_OCTET_STR,
            (const u_char*)m_pMIBTableTableDataMngrDataTerm->
                GetPtr(Stat, MIB_TABLE_STRING_ONE_ID, m_iMIBTableTableRow - 1),
            strlen(
                (const char*)m_pMIBTableTableDataMngrDataTerm->
                    GetPtr(Stat, MIB_TABLE_STRING_ONE_ID, m_iMIBTableTableRow - 
1));
        iRetCode = SNMPERR_SUCCESS;    
    break;

/MF

On tis, 2008-05-06 at 09:29 -0700, Leif Pitcock wrote: 
> Here is the code that I am using, if you have any questions let me know and I 
> will try to elaborate on it.
> 
> 
> Thanks for the help, 
> Leif Pitcock
> 
> 
> 
> ----- Original Message ----
> From: Dave Shield <[EMAIL PROTECTED]>
> To: Leif Pitcock <[EMAIL PROTECTED]>
> Cc: [email protected]
> Sent: Tuesday, May 6, 2008 3:30:06 AM
> Subject: Re: Using strings in MIB Tables
> 
> 2008/5/6 Leif Pitcock <[EMAIL PROTECTED]>:
> > What is the code you need in particular? It's alot of code, 1168 lines.
> >
> >  Resent with copy to net-snmp-coders.
> 
> That's somewhat larger than most MIB table code, but not
> excessively so.  (The UDP and TCP tables are 770 and 900
> lines of code respectively, and the original mteTriggerTable
> code was not far short of 4000 lines!)
> 
> It's difficult to know what to ask for, without some idea of the
> structure of your code.    If you've got example code that
> implements a single table, then post that.
>   Otherwise, post the whole thing (as an attachement
> preferably), so we can extract the relevant bits.
> 
> In general it's probably better to provide too much information,
> rather than too little :-)
> 
> Dave
> 
> 
>       
> ____________________________________________________________________________________
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now.  
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> ------------------------------------------------------------------------- 
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss 
> this year's exciting event. There's still time to save $100. Use priority 
> code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Net-snmp-coders mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to