Access violation when querying certain table cells

Frank Fock Frank.Fock____t-online.de
Sun May 20 20:38:13 CEST 2001


Hi Noam,

Why is the OctetStr constructor called whereas you assign a long
value to an integer? Are you sure that "value" is a SnmpIn32?

May be that helps...

Regards,
Frank

Noam Wolf wrote:

> Hi Frank
>
> I'm getting some access violation when trying to retrieve certain table
> cells' values.
> The columns of these cells are defined in a similar way to other columns in
> the table.
> I'm getting the segmantation error even if I'm trying to set a new value
> without using any outside functions, just by using: *((SnmpInt32*)value)
> =(long)newValue.
> When looking at the stack I could see that the violation occurs in the
> constructor of class OctetStr when trying to make:
>
> MEMCPY( smival.value.string.ptr,
>                   octet.smival.value.string.ptr,
>                   (size_t) octet.smival.value.string.len);
>
> octet.smival.value.string.ptr : Is pointing to NULL.
>
> When looking inside value, I could see it was initialized to all zeros
> (gdb) p this->smival.value
> $12 = {sNumber = 0, uNumber = 0, hNumber = {hipart = 0, lopart = 0}, string
> = {len = 0, ptr = 0x0}, oid = {len = 0, ptr = 0x0},
>   empty = 0 '\000'
>
> and after entering value a new value with the following operation:
> this->smival.value.sNumber = (unsigned long) i; //i = 62 in this case
>
> I could see this:
> {sNumber = 62, uNumber = 62, hNumber = {hipart = 62, lopart = 0}, string =
> {len = 62, ptr = 0x0}, oid = {len = 62, ptr = 0x0},
>   empty = 0 '\000'}
>
> My class is derived from MibLeaf and is defining new SnmpInt32. The new
> value I tried to enter was 62, but as you can see, it entered len and not
> ptr. ptr kept on pointing to NULL.
>
> Do you have any idea why this might happen?
>
> TIA and sorry for the trouble,




More information about the AGENTPP mailing list