Code Monkey home page Code Monkey logo

libdiurna's Introduction

stats languages

libdiurna's People

Contributors

thibaultmeyer avatar

Stargazers

 avatar

Watchers

 avatar  avatar

libdiurna's Issues

Missing realloc function return value judgment

src/appender/diurna_appender_file_write.c:

   memset(str_parsed, 0, sizeof(char) * allocated);
 23 
 24     while (ctx->output_filename[idx_str] != '\0') {
 25         if (ctx->output_filename[idx_str] == '{') {
 26             memset(variable, 0, sizeof(char) * 12);
 27             idx_variable = 0;
 28 
 29             while (ctx->output_filename[++idx_str] != '}' && idx_variable < 12) {
 30                 variable[idx_variable] = ctx->output_filename[idx_str];
 31                 idx_variable += 1;
 32             }
 33 
 34             if (strncmp(variable, "appname", 7) == 0) {
 35                 size_t appname_len = strlen(appname);
 36                 str_parsed = realloc(str_parsed, sizeof(char) * (allocated + appname_len) + 1);
 37 
 38                 memcpy(str_parsed + idx_str_parsed, appname, appname_len);
 39                 idx_str_parsed += appname_len;
 40                 allocated += appname_len;
 41             } else if (strncmp(variable, "date", 4) == 0) {
 42                 str_parsed = realloc(str_parsed, sizeof(char) * allocated + 11);
 43 
 44                 memcpy(str_parsed + idx_str_parsed, date, 10);
 45                 idx_str_parsed += 10;
 46                 allocated += 10;
 47             }
 48         } else {
 49             str_parsed[idx_str_parsed++] = ctx->output_filename[idx_str];
 50         }
 51 
 52         str_parsed[idx_str_parsed] = '\0';
 53         idx_str += 1;
 54     }

missing realloc function return value judgment

And I fixed the bug by th patch:
Added-realloc-function-return-value-judgment.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.