[GRASS-git] [OSGeo/grass] 1a8930: v.in.dwg: Avoid using same variable as parameter a...

Mohan Yelugoti noreply at github.com
Sun Sep 15 11:25:51 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 1a893014aa15e616715828f0d97306e7bf847d16
      https://github.com/OSGeo/grass/commit/1a893014aa15e616715828f0d97306e7bf847d16
  Author: Mohan Yelugoti <ymdatta.work at gmail.com>
  Date:   2024-09-15 (Sun, 15 Sep 2024)

  Changed paths:
    M vector/v.in.dwg/main.c

  Log Message:
  -----------
  v.in.dwg: Avoid using same variable as parameter and destination in sprintf (#4262)

v.in.dwg: Avoid using same variable as parameter and dest in sprintf

Currently, one instance of sprintf has the same variable as parameter
and destination in sprintf. This scenario leads to undefined
behavior in C.

Modify the code to:

1. Write initial error string using snprintf() onto the buffer.
   Using snprintf() makes sure that we stay within the buffer size
   and avoid overflow errors.

2. Use snprintf() again to write another error string at the end
   of previous error string in the same buffer. We again use
   snprintf() to make sure we are not overflowing the buffer with
   data.

Signed-off-by: Mohan Yelugoti <ymdatta.work at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list