Skip to content

Fix compiler warning: specified bound 4096 equals destination size#214

Open
kratz00 wants to merge 1 commit intotwogood:mainfrom
kratz00:oob
Open

Fix compiler warning: specified bound 4096 equals destination size#214
kratz00 wants to merge 1 commit intotwogood:mainfrom
kratz00:oob

Conversation

@kratz00
Copy link
Contributor

@kratz00 kratz00 commented Feb 13, 2026

Fixes the following compiler warning:

[6/13] Building C object lib/CMakeFiles/libunshield.dir/helper.c.o
/home/runner/work/unshield/unshield/lib/helper.c: In function ‘unshield_get_base_directory_name’:
/home/runner/work/unshield/unshield/lib/helper.c:50:9: warning: ‘__builtin_strncpy’ specified bound 4096 equals destination size [-Wstringop-truncation]
   50 |         strncpy(dirname, unshield->filename_pattern, path_max);
      |         ^

I guess it does not make sense to continue, if dirname is too small.
So I refactored the code and used the new UNSHIELD_ASSERT 😄

Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
@kratz00 kratz00 marked this pull request as ready for review February 13, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant