Code Monkey home page Code Monkey logo

lualwm2m's People

Contributors

jvermillard avatar sbernard31 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lualwm2m's Issues

segault on nil string values

==28475== Invalid read of size 1
==28475== at 0x4C2B932: strlen (mc_replace_strmem.c:404)
==28475== by 0x5603B0D: strdup (strdup.c:41)
==28475== by 0x5F599E9: prv_read_resource (lua_object.c:105)
==28475== by 0x5F59C4D: prv_read (lua_object.c:146)
==28475== by 0x5F5B9A9: object_read (objects.c:168)
==28475== by 0x5F5F494: handle_dm_request (management.c:69)
==28475== by 0x5F5DED9: handle_request (packet.c:119)
==28475== by 0x5F5E084: lwm2m_handle_packet (packet.c:200)
==28475== by 0x5F59591: llwm_handle (lua_liblwm2m.c:279)
==28475== by 0x407E67: ??? (in /usr/bin/lua5.1)
==28475== by 0x410D56: ??? (in /usr/bin/lua5.1)
==28475== by 0x4082AC: ??? (in /usr/bin/lua5.1)
==28475== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==28475==
==28475==
==28475== Process terminating with default action of signal 11 (SIGSEGV)
==28475== Access not within mapped region at address 0x0
==28475== at 0x4C2B932: strlen (mc_replace_strmem.c:404)
==28475== by 0x5603B0D: strdup (strdup.c:41)
==28475== by 0x5F599E9: prv_read_resource (lua_object.c:105)
==28475== by 0x5F59C4D: prv_read (lua_object.c:146)
==28475== by 0x5F5B9A9: object_read (objects.c:168)
==28475== by 0x5F5F494: handle_dm_request (management.c:69)
==28475== by 0x5F5DED9: handle_request (packet.c:119)
==28475== by 0x5F5E084: lwm2m_handle_packet (packet.c:200)
==28475== by 0x5F59591: llwm_handle (lua_liblwm2m.c:279)
==28475== by 0x407E67: ??? (in /usr/bin/lua5.1)
==28475== by 0x410D56: ??? (in /usr/bin/lua5.1)
==28475== by 0x4082AC: ??? (in /usr/bin/lua5.1)
==28475== If you believe this happened as a result of a stack
==28475== overflow in your program's main thread (unlikely but
==28475== possible), you can try to increase the size of the
==28475== main thread stack using the --main-stacksize= flag.
==28475== The main thread stack size used in this run was 8388608.
==28475==
==28475== HEAP SUMMARY:
==28475== in use at exit: 98,804 bytes in 1,151 blocks
==28475== total heap usage: 2,041 allocs, 890 frees, 236,214 bytes allocated
==28475==
==28475== LEAK SUMMARY:
==28475== definitely lost: 0 bytes in 0 blocks
==28475== indirectly lost: 0 bytes in 0 blocks
==28475== possibly lost: 0 bytes in 0 blocks
==28475== still reachable: 98,804 bytes in 1,151 blocks
==28475== suppressed: 0 bytes in 0 blocks
==28475== Rerun with --leak-check=full to see details of leaked memory
==28475==
==28475== For counts of detected and suppressed errors, rerun with: -v
==28475== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 3 from 3)
[1] 28475 segmentation fault valgrind lua ./demo.lua

If the string provided by the lua lwm2m object is nil then you have a strdup of the adresse zero

BTW strdup can fail you should check for errors on every memory allocation calls (malloc, strdup,..)
NULL dereferences it's can lead to some security issues.

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.