86 Star 471 Fork 273

GVPopenEuler / iSulad

 / 详情

【cutils】入参未作非空判断

已完成
缺陷 成员
创建于  
2022-05-13 17:38

【标题描述】能够简要描述问题:入参未作非空判断
【环境信息】
硬件信息:
1) 裸机场景提供出问题的硬件信息;
2) 虚机场景提供虚机XML文件或者配置信息
软件信息:
1) OS版本及分支
2) 内核信息
3) 发现问题的组件版本信息
如果有特殊组网,请提供网络拓扑图
【问题复现步骤】

  1. review代码
  2. 执行UT;
    出现概率(必先)
    【预期结果】
    无遗漏检查
    【实际结果】
    未作非空判断
    【附件信息】
    比如系统message日志/组件日志、dump信息、图片等
int util_getgrent_r(FILE *stream, struct group *resbuf, char *buffer, size_t buflen, struct group **result)
{
    const char delim = ':';

    if (stream == NULL || resbuf == NULL || buffer == NULL) {
        ERROR("Group obj, params is NULL.");
        return -1;
    }

    if (buflen <= 1) {
        ERROR("Inadiquate buffer length was given.");
        return -1;
    }

    if (*result != NULL) {
        ERROR("Result shall point to null to start.");
        return -1;
    }

util_getpwent_r 相似

问题汇总:

  1. hold_int must return error when invalid digits, ie. "root:x:1a";
  2. hold_string_list return NULL only overflow buffer, other return buff_start;
  3. parse_line_gr must check hold_string_list return;
  4. must check result argument is not NULL;
  5. use '\xff' to check buffer is overflow;
  6. uid only should be invalid

评论 (1)

haozi007 创建了缺陷

Hi duguhaotian, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: iSulad, and any of the maintainers: @haomintsai , @lifeng_isula , @haozi007 , @jingxiaolu , @JingWoo

openeuler-ci-bot 添加了
 
sig/iSulad
标签
haozi007 通过openeuler/iSulad Pull Request !1412任务状态待办的 修改为已完成
haozi007 修改了描述
haozi007 修改了描述

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
5329419 openeuler ci bot 1632792936 5595769 duguhaotian 1605235330
C
1
https://gitee.com/openeuler/iSulad.git
git@gitee.com:openeuler/iSulad.git
openeuler
iSulad
iSulad

搜索帮助