SNMP xxget_value buffer size and SNMP string termination

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SNMP xxget_value buffer size and SNMP string termination

Mario Luzeiro
Hi all,

I have two questions about SNMP buffers and strings:

- on LWIP SNMP, when it gets a value, it passes a "void *value" but there is no indication about the buffer size. I learned that the SNMP max length of a string is 255. Is it safe to write always that amount of data to *value ?

- from what I see in LWIP SNMP code, it looks that SNMP strings are *not* NULL terminated. Searching in the web it was a bit inconclusive, could some one clarify?

Regards,
Mario Luzeiro
_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: SNMP xxget_value buffer size and SNMP string termination

Mario Luzeiro
> - from what I see in LWIP SNMP code, it looks that SNMP strings are *not* NULL terminated. Searching in the web it was a bit inconclusive, could some one clarify?

Replying to my own second question:

From what I learned,
SNMP protocol with conformity of the Basic Encoding Rules, sets the type and length of the data. As the length is implicit known, it is up to the application implementation to handle it correctly.

Mario Luzeiro

________________________________________
From: lwip-users <lwip-users-bounces+mrluzeiro=[hidden email]> on behalf of Mário Luzeiro <[hidden email]>
Sent: 20 November 2019 09:33
To: [hidden email]
Subject: [lwip-users] SNMP xxget_value buffer size and SNMP string termination

Hi all,

I have two questions about SNMP buffers and strings:

- on LWIP SNMP, when it gets a value, it passes a "void *value" but there is no indication about the buffer size. I learned that the SNMP max length of a string is 255. Is it safe to write always that amount of data to *value ?

- from what I see in LWIP SNMP code, it looks that SNMP strings are *not* NULL terminated. Searching in the web it was a bit inconclusive, could some one clarify?

Regards,
Mario Luzeiro
_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users