Commit 6e7e171d authored by Rich Salz's avatar Rich Salz
Browse files

Convert uses of snprintf to BIO_snprintf



Fixes #2360
Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3366)

(cherry picked from commit c41048ff)
parent b66ccb4c
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -362,7 +362,7 @@ static int do_dir(const char *dirname, enum Hash h)
    numfiles = sk_OPENSSL_STRING_num(files);
    numfiles = sk_OPENSSL_STRING_num(files);
    for (n = 0; n < numfiles; ++n) {
    for (n = 0; n < numfiles; ++n) {
        filename = sk_OPENSSL_STRING_value(files, n);
        filename = sk_OPENSSL_STRING_value(files, n);
        if (snprintf(buf, buflen, "%s%s%s",
        if (BIO_snprintf(buf, buflen, "%s%s%s",
                         dirname, pathsep, filename) >= buflen)
                         dirname, pathsep, filename) >= buflen)
            continue;
            continue;
        if (lstat(buf, &st) < 0)
        if (lstat(buf, &st) < 0)
@@ -386,7 +386,7 @@ static int do_dir(const char *dirname, enum Hash h)
                nextep = ep->next;
                nextep = ep->next;
                if (ep->old_id < bp->num_needed) {
                if (ep->old_id < bp->num_needed) {
                    /* Link exists, and is used as-is */
                    /* Link exists, and is used as-is */
                    snprintf(buf, buflen, "%08x.%s%d", bp->hash,
                    BIO_snprintf(buf, buflen, "%08x.%s%d", bp->hash,
                                 suffixes[bp->type], ep->old_id);
                                 suffixes[bp->type], ep->old_id);
                    if (verbose)
                    if (verbose)
                        BIO_printf(bio_out, "link %s -> %s\n",
                        BIO_printf(bio_out, "link %s -> %s\n",
@@ -396,7 +396,7 @@ static int do_dir(const char *dirname, enum Hash h)
                    while (bit_isset(idmask, nextid))
                    while (bit_isset(idmask, nextid))
                        nextid++;
                        nextid++;


                    snprintf(buf, buflen, "%s%s%n%08x.%s%d",
                    BIO_snprintf(buf, buflen, "%s%s%n%08x.%s%d",
                                 dirname, pathsep, &n, bp->hash,
                                 dirname, pathsep, &n, bp->hash,
                                 suffixes[bp->type], nextid);
                                 suffixes[bp->type], nextid);
                    if (verbose)
                    if (verbose)
@@ -418,7 +418,7 @@ static int do_dir(const char *dirname, enum Hash h)
                    bit_set(idmask, nextid);
                    bit_set(idmask, nextid);
                } else if (remove_links) {
                } else if (remove_links) {
                    /* Link to be deleted */
                    /* Link to be deleted */
                    snprintf(buf, buflen, "%s%s%n%08x.%s%d",
                    BIO_snprintf(buf, buflen, "%s%s%n%08x.%s%d",
                                 dirname, pathsep, &n, bp->hash,
                                 dirname, pathsep, &n, bp->hash,
                                 suffixes[bp->type], ep->old_id);
                                 suffixes[bp->type], ep->old_id);
                    if (verbose)
                    if (verbose)