Revision 1a5e4fd8

View differences:

ffmpeg.c
3695 3695
    char *p;
3696 3696
    char idx_str[16];
3697 3697

  
3698
    strncpy(idx_str, arg, sizeof(idx_str));
3699
    idx_str[sizeof(idx_str)-1] = '\0';
3698
    av_strlcpy(idx_str, arg, sizeof(idx_str));
3700 3699
    p = strchr(idx_str, ':');
3701 3700
    if (!p) {
3702 3701
        fprintf(stderr,
libavcodec/ac3enc.c
33 33

  
34 34
#include "libavutil/audioconvert.h"
35 35
#include "libavutil/avassert.h"
36
#include "libavutil/avstring.h"
36 37
#include "libavutil/crc.h"
37 38
#include "libavutil/opt.h"
38 39
#include "avcodec.h"
......
1578 1579
    char strbuf[32];
1579 1580

  
1580 1581
    switch (s->bitstream_id) {
1581
    case  6:  strncpy(strbuf, "AC-3 (alt syntax)", 32);      break;
1582
    case  8:  strncpy(strbuf, "AC-3 (standard)", 32);        break;
1583
    case  9:  strncpy(strbuf, "AC-3 (dnet half-rate)", 32);  break;
1584
    case 10:  strncpy(strbuf, "AC-3 (dnet quater-rate", 32); break;
1582
    case  6:  av_strlcpy(strbuf, "AC-3 (alt syntax)", 32);      break;
1583
    case  8:  av_strlcpy(strbuf, "AC-3 (standard)", 32);        break;
1584
    case  9:  av_strlcpy(strbuf, "AC-3 (dnet half-rate)", 32);  break;
1585
    case 10:  av_strlcpy(strbuf, "AC-3 (dnet quater-rate", 32); break;
1585 1586
    default: snprintf(strbuf, 32, "ERROR");
1586 1587
    }
1587 1588
    av_dlog(avctx, "bitstream_id: %s (%d)\n", strbuf, s->bitstream_id);
......
1608 1609
    if (opt->audio_production_info) {
1609 1610
        av_dlog(avctx, "mixing_level: %ddB\n", opt->mixing_level);
1610 1611
        switch (opt->room_type) {
1611
        case 0:  strncpy(strbuf, "notindicated", 32); break;
1612
        case 1:  strncpy(strbuf, "large", 32);        break;
1613
        case 2:  strncpy(strbuf, "small", 32);        break;
1612
        case 0:  av_strlcpy(strbuf, "notindicated", 32); break;
1613
        case 1:  av_strlcpy(strbuf, "large", 32);        break;
1614
        case 2:  av_strlcpy(strbuf, "small", 32);        break;
1614 1615
        default: snprintf(strbuf, 32, "ERROR (%d)", opt->room_type);
1615 1616
        }
1616 1617
        av_dlog(avctx, "room_type: %s\n", strbuf);
......
1622 1623
    av_dlog(avctx, "dialnorm: %ddB\n", opt->dialogue_level);
1623 1624
    if (s->channel_mode == AC3_CHMODE_STEREO) {
1624 1625
        switch (opt->dolby_surround_mode) {
1625
        case 0:  strncpy(strbuf, "notindicated", 32); break;
1626
        case 1:  strncpy(strbuf, "on", 32);           break;
1627
        case 2:  strncpy(strbuf, "off", 32);          break;
1626
        case 0:  av_strlcpy(strbuf, "notindicated", 32); break;
1627
        case 1:  av_strlcpy(strbuf, "on", 32);           break;
1628
        case 2:  av_strlcpy(strbuf, "off", 32);          break;
1628 1629
        default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_mode);
1629 1630
        }
1630 1631
        av_dlog(avctx, "dsur_mode: %s\n", strbuf);
......
1636 1637
    if (s->bitstream_id == 6) {
1637 1638
        if (opt->extended_bsi_1) {
1638 1639
            switch (opt->preferred_stereo_downmix) {
1639
            case 0:  strncpy(strbuf, "notindicated", 32); break;
1640
            case 1:  strncpy(strbuf, "ltrt", 32);         break;
1641
            case 2:  strncpy(strbuf, "loro", 32);         break;
1640
            case 0:  av_strlcpy(strbuf, "notindicated", 32); break;
1641
            case 1:  av_strlcpy(strbuf, "ltrt", 32);         break;
1642
            case 2:  av_strlcpy(strbuf, "loro", 32);         break;
1642 1643
            default: snprintf(strbuf, 32, "ERROR (%d)", opt->preferred_stereo_downmix);
1643 1644
            }
1644 1645
            av_dlog(avctx, "dmix_mode: %s\n", strbuf);
......
1655 1656
        }
1656 1657
        if (opt->extended_bsi_2) {
1657 1658
            switch (opt->dolby_surround_ex_mode) {
1658
            case 0:  strncpy(strbuf, "notindicated", 32); break;
1659
            case 1:  strncpy(strbuf, "on", 32);           break;
1660
            case 2:  strncpy(strbuf, "off", 32);          break;
1659
            case 0:  av_strlcpy(strbuf, "notindicated", 32); break;
1660
            case 1:  av_strlcpy(strbuf, "on", 32);           break;
1661
            case 2:  av_strlcpy(strbuf, "off", 32);          break;
1661 1662
            default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_surround_ex_mode);
1662 1663
            }
1663 1664
            av_dlog(avctx, "dsurex_mode: %s\n", strbuf);
1664 1665
            switch (opt->dolby_headphone_mode) {
1665
            case 0:  strncpy(strbuf, "notindicated", 32); break;
1666
            case 1:  strncpy(strbuf, "on", 32);           break;
1667
            case 2:  strncpy(strbuf, "off", 32);          break;
1666
            case 0:  av_strlcpy(strbuf, "notindicated", 32); break;
1667
            case 1:  av_strlcpy(strbuf, "on", 32);           break;
1668
            case 2:  av_strlcpy(strbuf, "off", 32);          break;
1668 1669
            default: snprintf(strbuf, 32, "ERROR (%d)", opt->dolby_headphone_mode);
1669 1670
            }
1670 1671
            av_dlog(avctx, "dheadphone_mode: %s\n", strbuf);
1671 1672

  
1672 1673
            switch (opt->ad_converter_type) {
1673
            case 0:  strncpy(strbuf, "standard", 32); break;
1674
            case 1:  strncpy(strbuf, "hdcd", 32);     break;
1674
            case 0:  av_strlcpy(strbuf, "standard", 32); break;
1675
            case 1:  av_strlcpy(strbuf, "hdcd", 32);     break;
1675 1676
            default: snprintf(strbuf, 32, "ERROR (%d)", opt->ad_converter_type);
1676 1677
            }
1677 1678
            av_dlog(avctx, "ad_conv_type: %s\n", strbuf);
libavcodec/ass.c
21 21

  
22 22
#include "avcodec.h"
23 23
#include "ass.h"
24
#include "libavutil/avstring.h"
24 25

  
25 26
/**
26 27
 * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS.
......
117 118
    rects[sub->num_rects]->type = SUBTITLE_ASS;
118 119
    rects[sub->num_rects]->ass  = av_malloc(len + dlen + 1);
119 120
    strcpy (rects[sub->num_rects]->ass      , header);
120
    strncpy(rects[sub->num_rects]->ass + len, dialog, dlen);
121
    rects[sub->num_rects]->ass[len+dlen] = 0;
121
    av_strlcpy(rects[sub->num_rects]->ass + len, dialog, dlen + 1);
122 122
    sub->num_rects++;
123 123
    return dlen;
124 124
}
libavformat/movenc.c
827 827
    memset(compressor_name,0,32);
828 828
    /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
829 829
    if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name)
830
        strncpy(compressor_name,track->enc->codec->name,31);
830
        av_strlcpy(compressor_name,track->enc->codec->name,32);
831 831
    avio_w8(pb, strlen(compressor_name));
832 832
    avio_write(pb, compressor_name, 31);
833 833

  
libavformat/mp3enc.c
24 24
#include "id3v1.h"
25 25
#include "id3v2.h"
26 26
#include "rawenc.h"
27
#include "libavutil/avstring.h"
27 28
#include "libavutil/intreadwrite.h"
28 29
#include "libavutil/opt.h"
29 30

  
......
32 33
{
33 34
    AVMetadataTag *tag;
34 35
    if ((tag = av_metadata_get(s->metadata, key, NULL, 0)))
35
        strncpy(buf, tag->value, buf_size);
36
        av_strlcpy(buf, tag->value, buf_size);
36 37
    return !!tag;
37 38
}
38 39

  
libavutil/log.c
26 26

  
27 27
#include <unistd.h>
28 28
#include <stdlib.h>
29
#include "avstring.h"
29 30
#include "avutil.h"
30 31
#include "log.h"
31 32

  
......
120 121
        count=0;
121 122
    }
122 123
    colored_fputs(av_clip(level>>3, 0, 6), line);
123
    strncpy(prev, line, sizeof line);
124
    av_strlcpy(prev, line, sizeof line);
124 125
}
125 126

  
126 127
static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback;
libpostproc/postprocess.c
86 86
//#define DEBUG_BRIGHTNESS
87 87
#include "postprocess.h"
88 88
#include "postprocess_internal.h"
89
#include "libavutil/avstring.h"
89 90

  
90 91
unsigned postproc_version(void)
91 92
{
......
762 763
    ppMode->maxClippedThreshold= 0.01;
763 764
    ppMode->error=0;
764 765

  
765
    strncpy(temp, name, GET_MODE_BUFFER_SIZE);
766
    av_strlcpy(temp, name, GET_MODE_BUFFER_SIZE);
766 767

  
767 768
    av_log(NULL, AV_LOG_DEBUG, "pp: %s\n", name);
768 769

  

Also available in: Unified diff