[devel] не собирается toppler. Прошу помощи.

Alexey Tourbin at at altlinux.ru
Thu Aug 6 10:37:39 MSD 2009


On Thu, Aug 06, 2009 at 10:19:44AM +0400, "Шишков Е.В." wrote:
> Всем привет.
> 
> Был в отпуске. Пока отдыхал, перестал 
> пакетик мой собираться (toppler).
> Попытался починить - не получается.
> 
> leveledit.o leveledit.cc
> leveledit.cc: In function 'void le_edit()':
> leveledit.cc:519: warning: deprecated conversion from string constant to 
> 'char*'
> In file included from /usr/include/stdio.h:912,
>                  from decl.h:24,
>                  from leveledit.cc:21:
> In function 'int snprintf(char*, size_t, const char*, ...)',
>     inlined from 'void le_showkeyhelp(int, int)' at leveledit.cc:439,
>     inlined from 'void le_edit()' at leveledit.cc:935:
> /usr/include/bits/stdio2.h:66: error: call to int 
> __builtin___snprintf_chk(char*, unsigned int, int, unsigned int, const 
> char*, ...) will always overflow destination buffer

leveledit.cc:
   411  static void le_showkeyhelp(int row, int col) {
   412    int k;
   413    int maxkeylen = 0;
   414    textsystem *ts = new textsystem(_("Editor Key Help"), editor_background_menu_proc);
   415    char tabbuf1[6], tabbuf2[6];
   416      
   417    if (!ts) return;
   418  
   419    for (k = 0; k < SIZE(_ed_keys); k++) {
   420        char knam[256];
   421        snprintf(knam, 256, "%s%s", keymod2str(_ed_keys[k].mod), SDL_GetKeyName(_ed_keys[k].key));
   422        int l = scr_textlength(knam);
   423        
   424        if (l > maxkeylen) maxkeylen = l;
   425    }
   426  
   427    snprintf(tabbuf1, 6, "%3i", maxkeylen + FONTWID);
   428    if (tabbuf1[0] < '0') tabbuf1[0] = '0';
   429    if (tabbuf1[1] < '0') tabbuf1[1] = '0';
   430    if (tabbuf1[2] < '0') tabbuf1[2] = '0';
   431      
   432    for (k = 0; k < SIZE(_ed_keys); k++) {
   433        char buf[256];
   434        char tmpb[256];
   435        char knam[256];
   436  
   437        snprintf(knam, 256, "%s%s", keymod2str(_ed_keys[k].mod), SDL_GetKeyName(_ed_keys[k].key));
   438        
   439        snprintf(tabbuf2, 256, "%3i", maxkeylen - scr_textlength(knam));
   440        if (tabbuf2[0] < '0') tabbuf2[0] = '0';
   441        if (tabbuf2[1] < '0') tabbuf2[1] = '0';
   442        if (tabbuf2[2] < '0') tabbuf2[2] = '0';

В строке 439 у sprintf неправильный аргумент "размер буфера":
буфер объявлен как tabbuf2[6] (строка 415), а печатают в него
как будто он 256 байтов.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.altlinux.org/pipermail/devel/attachments/20090806/ac54c3dd/attachment-0001.bin>


More information about the Devel mailing list