Revert "made _asn1_ltostr() safer."
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 17 May 2014 07:05:15 +0000 (09:05 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 17 May 2014 07:05:15 +0000 (09:05 +0200)
This reverts commit 07a5adb87880f3fce80aa12121409bbf652f1b6d.

lib/coding.c
lib/decoding.c
lib/element.c
lib/parser_aux.h

index c560ebf..e4eb060 100644 (file)
@@ -631,7 +631,7 @@ _asn1_insert_tag_der (asn1_node node, unsigned char *der, int *counter,
                    memcpy (der + *counter, tag_der, tag_len);
                  *counter += tag_len;
 
-                 _asn1_ltostr (*counter, (char *) temp, sizeof(temp));
+                 _asn1_ltostr (*counter, (char *) temp);
                  _asn1_set_name (p, (const char *) temp);
 
                  is_tag_implicit = 0;
@@ -1187,7 +1187,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
        case ASN1_ETYPE_SET:
          if (move != UP)
            {
-             _asn1_ltostr (counter, (char *) temp, sizeof(temp));
+             _asn1_ltostr (counter, (char *) temp);
              tlen = _asn1_strlen (temp);
              if (tlen > 0)
                _asn1_set_value (p, temp, tlen + 1);
@@ -1236,7 +1236,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
        case ASN1_ETYPE_SET_OF:
          if (move != UP)
            {
-             _asn1_ltostr (counter, (char *) temp, sizeof(temp));
+             _asn1_ltostr (counter, (char *) temp);
              tlen = _asn1_strlen (temp);
 
              if (tlen > 0)
index bd96d90..f85451f 100644 (file)
@@ -320,9 +320,9 @@ _asn1_get_objectid_der (const unsigned char *der, int der_len, int *ret_len,
   val1 = der[len_len] / 40;
   val = der[len_len] - val1 * 40;
 
-  _asn1_str_cpy (str, str_size, _asn1_ltostr (val1, temp, sizeof(temp)));
+  _asn1_str_cpy (str, str_size, _asn1_ltostr (val1, temp));
   _asn1_str_cat (str, str_size, ".");
-  _asn1_str_cat (str, str_size, _asn1_ltostr (val, temp, sizeof(temp)));
+  _asn1_str_cat (str, str_size, _asn1_ltostr (val, temp));
 
   val = 0;
   leading = 1;
@@ -344,7 +344,7 @@ _asn1_get_objectid_der (const unsigned char *der, int der_len, int *ret_len,
       if (!(der[len_len + k] & 0x80))
        {
          _asn1_str_cat (str, str_size, ".");
-         _asn1_str_cat (str, str_size, _asn1_ltostr (val, temp, sizeof(temp)));
+         _asn1_str_cat (str, str_size, _asn1_ltostr (val, temp));
          val = 0;
          leading = 1;
        }
@@ -1251,7 +1251,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
 
                  if (len3 > 0)
                    {
-                     _asn1_ltostr (counter + len3, temp, sizeof(temp));
+                     _asn1_ltostr (counter + len3, temp);
                      tlen = strlen (temp);
                      if (tlen > 0)
                        _asn1_set_value (p, temp, tlen + 1);
@@ -1339,7 +1339,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
                    {
                      if (len3 > 0)
                        {       /* definite length method */
-                         _asn1_ltostr (counter + len3, temp, sizeof(temp));
+                         _asn1_ltostr (counter + len3, temp);
                          tlen = strlen (temp);
 
                          if (tlen > 0)
index d748f46..3f31aa2 100644 (file)
@@ -152,7 +152,7 @@ _asn1_append_sequence_set (asn1_node node)
       n = strtol (p->name + 1, NULL, 0);
       n++;
       temp[0] = '?';
-      _asn1_ltostr (n, temp + 1, sizeof(temp)-1);
+      _asn1_ltostr (n, temp + 1);
     }
   _asn1_set_name (p2, temp);
   /*  p2->type |= CONST_OPTION; */
index 8ef105b..ee01725 100644 (file)
@@ -27,9 +27,9 @@
 /***************************************/
 
 inline static char *
-_asn1_ltostr (long v, char *str, size_t str_size)
+_asn1_ltostr (long v, char *str)
 {
-  snprintf(str, str_size, "%ld", v);
+  sprintf(str, "%ld", v);
   return str;
 }
 
@@ -60,6 +60,8 @@ void _asn1_delete_list (void);
 
 void _asn1_delete_list_and_nodes (void);
 
+char *_asn1_ltostr (long v, char *str);
+
 asn1_node _asn1_find_up (asn1_node node);
 
 int _asn1_change_integer_value (asn1_node node);