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

Security issue / bug #11

Open
TotallyNotAHaxxer opened this issue Mar 21, 2022 · 3 comments
Open

Security issue / bug #11

TotallyNotAHaxxer opened this issue Mar 21, 2022 · 3 comments

Comments

@TotallyNotAHaxxer
Copy link

TotallyNotAHaxxer commented Mar 21, 2022

No description provided.

@TotallyNotAHaxxer
Copy link
Author

no comment,, decided top delete will come back with this in a few hours!

@TotallyNotAHaxxer TotallyNotAHaxxer changed the title warning in your code, security issue Solved Mar 21, 2022
@TotallyNotAHaxxer
Copy link
Author

error in block

#cgo LDFLAGS: -lcrypt
#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <crypt.h>
char *gnu_ext_crypt(char *pass, char *salt) {
  char *enc = NULL;
  char *ret = NULL;
  struct crypt_data data;
  data.initialized = 0;
  enc = crypt_r(pass, salt, &data);
  if(enc == NULL) {
    return NULL;
  }
  ret = (char *)malloc(strlen(enc)+1); // for trailing null
  strncpy(ret, enc, strlen(enc));
  ret[strlen(enc)]= '\0'; // paranoid
  return ret;
}

this should be ingored but in order from it annoying users and creating security issues, its best to fix it

warning

./test.go: In functiongnu_ext_crypt’:
./test.go:32:3: warning: ‘strncpyspecified bound depends on the length of the source argument [-Wstringop-overflow=]
   32 |   strncpy(ret, enc, strlen(enc));
      |   ^~~~~~~~~~~~~~~~~~~

@TotallyNotAHaxxer TotallyNotAHaxxer changed the title Solved Security issue / bug Mar 21, 2022
@alan-nettica
Copy link

I've opened a pull request to fix this build break.

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

2 participants