Skip to content

Commit

Permalink
Replace sprintf with snprintf (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjw10086 authored Dec 13, 2024
1 parent fbf96e7 commit fbabeff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion godal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ typedef void (*fn_def)(void);

int _go_registerDriver(const char *driver, const char *prefix) {
char *fnname = (char*)calloc(1,strlen(driver)+strlen(prefix)+1);
sprintf(fnname,"%s%s",prefix,driver);
snprintf(fnname, sizeof(fnname), "%s%s", prefix, driver);
void *fcn = dlsym(RTLD_DEFAULT,fnname);
free(fnname);
if (fcn != nullptr) {
Expand Down

0 comments on commit fbabeff

Please sign in to comment.