Changeset e436cfe in mainline


Ignore:
Timestamp:
2008-10-02T07:49:38Z (16 years ago)
Author:
Tim Post <echo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c2ad500
Parents:
119c335
Message:

cli_redup() should be size_t and return as such to avoid undefined behavior with large strings.

Location:
uspace/app/bdsh
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/util.c

    r119c335 re436cfe  
    7676 * Return -1 on failure, or the length of the copied string on success.
    7777 */
    78 int cli_redup(char **s1, const char *s2)
     78size_t cli_redup(char **s1, const char *s2)
    7979{
    8080        size_t len = strlen(s2) + 1;
     
    9393        memcpy(*s1, s2, len);
    9494        cli_errno = CL_EOK;
    95         return (int) len;
     95        return len;
    9696}
    9797
  • uspace/app/bdsh/util.h

    r119c335 re436cfe  
    66/* Internal string handlers */
    77extern char * cli_strdup(const char *);
    8 extern int cli_redup(char **, const char *);
     8extern size_t cli_redup(char **, const char *);
    99extern int cli_psprintf(char **, const char *, ...);
    1010extern char * cli_strtok_r(char *, const char *, char **);
Note: See TracChangeset for help on using the changeset viewer.