This commit was generated by cvs2svn to compensate for changes in r155429,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
74b07c5412
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=155430
@ -120,6 +120,30 @@ string_get(struct snmp_value *value, const u_char *ptr, ssize_t len)
|
||||
return (SNMP_ERR_NOERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a string value for a response packet but cut it if it is too long.
|
||||
*/
|
||||
int
|
||||
string_get_max(struct snmp_value *value, const u_char *ptr, ssize_t len,
|
||||
size_t maxlen)
|
||||
{
|
||||
|
||||
if (ptr == NULL) {
|
||||
value->v.octetstring.len = 0;
|
||||
value->v.octetstring.octets = NULL;
|
||||
return (SNMP_ERR_NOERROR);
|
||||
}
|
||||
if (len == -1)
|
||||
len = strlen(ptr);
|
||||
if ((size_t)len > maxlen)
|
||||
len = maxlen;
|
||||
value->v.octetstring.len = (u_long)len;
|
||||
if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL)
|
||||
return (SNMP_ERR_RES_UNAVAIL);
|
||||
memcpy(value->v.octetstring.octets, ptr, (size_t)len);
|
||||
return (SNMP_ERR_NOERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Support for IPADDRESS
|
||||
*
|
||||
|
@ -400,6 +400,7 @@ int string_save(struct snmp_value *, struct snmp_context *, ssize_t, u_char **);
|
||||
void string_commit(struct snmp_context *);
|
||||
void string_rollback(struct snmp_context *, u_char **);
|
||||
int string_get(struct snmp_value *, const u_char *, ssize_t);
|
||||
int string_get_max(struct snmp_value *, const u_char *, ssize_t, size_t);
|
||||
void string_free(struct snmp_context *);
|
||||
|
||||
int ip_save(struct snmp_value *, struct snmp_context *, u_char *);
|
||||
|
Loading…
Reference in New Issue
Block a user