- char desc_str[200];
- struct oident_list *oident_list;
- oident_list = (struct oident_list *)
- nmem_malloc (oid_nmem, sizeof(*oident_list));
- oident = &oident_list->oident;
- oident->proto = proto;
- oident->oclass = oclass;
-
- if (!desc)
- {
- int i;
-
- sprintf (desc_str, "%d", *oid);
- for (i = 1; i < 12 && oid[i] >= 0; i++)
- sprintf (desc_str+strlen(desc_str), ".%d", oid[i]);
- desc = desc_str;
- }
- oident->desc = nmem_strdup (oid_nmem, desc);
- if (value == VAL_DYNAMIC)
- oident->value = (enum oid_value) (++oid_value_dynamic);
- else
- oident->value = (enum oid_value) value;
- oid_oidcpy (oident->oidsuffix, oid);
- oident_list->next = oident_table;
- oident_table = oident_list;
+ struct oident_list *oident_list;
+ oident_list = (struct oident_list *)
+ nmem_malloc (oid_nmem, sizeof(*oident_list));
+ oident = &oident_list->oident;
+ oident->proto = proto;
+ oident->oclass = oclass;
+
+ if (!desc)
+ {
+ char desc_str[OID_STR_MAX];
+ int i;
+
+ *desc_str = '\0';
+ if (*oid >= 0)
+ {
+ sprintf (desc_str, "%d", *oid);
+ for (i = 1; i < OID_SIZE && oid[i] >= 0; i++)
+ sprintf (desc_str+strlen(desc_str), ".%d", oid[i]);
+ }
+ oident->desc = nmem_strdup(oid_nmem, desc_str);
+ }
+ else
+ oident->desc = nmem_strdup(oid_nmem, desc);
+ if (value == VAL_DYNAMIC)
+ oident->value = (enum oid_value) (++oid_value_dynamic);
+ else
+ oident->value = (enum oid_value) value;
+ oid_oidcpy (oident->oidsuffix, oid);
+ oident_list->next = oident_table;
+ oident_table = oident_list;