Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] #139

Open
gokulprathin8 opened this issue Nov 26, 2024 · 0 comments

Comments

@gokulprathin8
Copy link

warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]

Occurs at:

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);     <------------------------------
	void *fcn = dlsym(RTLD_DEFAULT,fnname);
	free(fnname);
	if (fcn != nullptr) {
		fn_def fnptr = (fn_def)fcn;
		fnptr();
	} else {
		return 1;
	}
	return 0;
}
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

No branches or pull requests

1 participant