IS: resolve Coverity warnings

This commit is contained in:
David van Moolenbroek 2012-08-07 13:09:09 +02:00
parent fd8c6c1d30
commit aa5531fc67
3 changed files with 12 additions and 15 deletions

View file

@ -99,11 +99,11 @@ static char *key_name(int key)
static char name[15]; static char name[15];
if(key >= F1 && key <= F12) if(key >= F1 && key <= F12)
sprintf(name, " F%d", key - F1 + 1); snprintf(name, sizeof(name), " F%d", key - F1 + 1);
else if(key >= SF1 && key <= SF12) else if(key >= SF1 && key <= SF12)
sprintf(name, "Shift+F%d", key - SF1 + 1); snprintf(name, sizeof(name), "Shift+F%d", key - SF1 + 1);
else else
sprintf(name, "?"); strlcpy(name, "?", sizeof(name));
return name; return name;
} }

View file

@ -62,7 +62,7 @@ void fproc_dmp()
static char * dmap_flags(int flags) static char * dmap_flags(int flags)
{ {
static char fl[10]; static char fl[10];
strcpy(fl, "-----"); strlcpy(fl, "-----", sizeof(fl));
if(flags & DRV_FORCED) fl[0] = 'F'; if(flags & DRV_FORCED) fl[0] = 'F';
return fl; return fl;
} }
@ -72,18 +72,15 @@ static char * dmap_flags(int flags)
*===========================================================================*/ *===========================================================================*/
static char * dmap_style(int dev_style) static char * dmap_style(int dev_style)
{ {
static char str[16];
switch(dev_style) { switch(dev_style) {
case STYLE_DEV: strcpy(str, "STYLE_DEV"); break; case STYLE_DEV: return "STYLE_DEV";
case STYLE_DEVA: strcpy(str, "STYLE_DEVA"); break; case STYLE_DEVA: return "STYLE_DEVA";
case STYLE_TTY: strcpy(str, "STYLE_TTY"); break; case STYLE_TTY: return "STYLE_TTY";
case STYLE_CTTY: strcpy(str, "STYLE_CTTY"); break; case STYLE_CTTY: return "STYLE_CTTY";
case STYLE_CLONE: strcpy(str, "STYLE_CLONE"); break; case STYLE_CLONE: return "STYLE_CLONE";
case STYLE_CLONE_A: strcpy(str, "STYLE_CLONE_A"); break; case STYLE_CLONE_A: return "STYLE_CLONE_A";
default: strcpy(str, "UNKNOWN"); break; default: return "UNKNOWN";
} }
return str;
} }
/*===========================================================================* /*===========================================================================*

View file

@ -63,7 +63,7 @@ extern struct minix_kerninfo *_minix_kerninfo;
void kmessages_dmp() void kmessages_dmp()
{ {
struct kmessages *kmess; /* get copy of kernel messages */ struct kmessages *kmess; /* get copy of kernel messages */
char print_buf[_KMESS_BUF_SIZE+1]; /* this one is used to print */ static char print_buf[_KMESS_BUF_SIZE+1]; /* this one is used to print */
int start; /* calculate start of messages */ int start; /* calculate start of messages */
int r; int r;
int size; int size;