Changeset d252351 in rtems


Ignore:
Timestamp:
Mar 15, 2011, 3:02:41 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
315c9b89
Parents:
4e553c60
Message:

2011-03-15 Joel Sherrill <joel.sherrill@…>

  • libmisc/shell/main_setenv.c: Address Coverity issue 134 which recommends using strnXXX methods.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r4e553c60 rd252351  
     12011-03-15      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * libmisc/shell/main_setenv.c: Address Coverity issue 134 which
     4        recommends using strnXXX methods.
     5
    162011-03-15      Sebastian Huber <sebastian.huber@embedded-brains.de>
    27
  • cpukit/libmisc/shell/main_setenv.c

    r4e553c60 rd252351  
    1717#include "internal.h"
    1818
     19/*
     20 *  Limit examining or copying more than 256 characters at a time.
     21 *  Yes, this is very arbitrary.  If there are POSIX constants, then
     22 *  they should be used.
     23 */
     24#define MAX 156
     25
    1926int rtems_shell_main_setenv(int argc, char *argv[])
    2027{
     
    3340
    3441  for (arg = 2; arg < argc; arg++)
    35     len += strlen(argv[arg]);
     42    len += strnlen(argv[arg], MAX);
    3643
    3744  len += argc - 2 - 1;
     
    4552
    4653  for (arg = 2, p = string; arg < argc; arg++) {
    47     strcpy(p, argv[arg]);
    48     p += strlen(argv[arg]);
     54    strncpy(p, argv[arg], MAX);
     55    p += strnlen(argv[arg], MAX);
    4956    if (arg < (argc - 1)) {
    5057      *p = ' ';
Note: See TracChangeset for help on using the changeset viewer.