[Pkg-wmaker-commits] [wmbiff] 15/15: oh, now I get why that foolish null-termination was present. it's better now
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:03:22 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to tag wmbiff_0_4_15
in repository wmbiff.
commit b914f5d05460b683d6a2cb913ba87a09a8ae2352
Author: bluehal <bluehal>
Date: Sun Mar 30 11:47:00 2003 +0000
oh, now I get why that foolish null-termination was present. it's better now
---
wmbiff/passwordMgr.c | 6 ++++++
wmbiff/test_wmbiff.c | 11 ++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/wmbiff/passwordMgr.c b/wmbiff/passwordMgr.c
index 13318fd..1e416d4 100644
--- a/wmbiff/passwordMgr.c
+++ b/wmbiff/passwordMgr.c
@@ -159,6 +159,12 @@ char *passwordFor(const char *username,
#endif
p->next = pass_list;
pass_list = p;
+ if (strlen(password_ptr) > 31) {
+ DM(pc, DEBUG_ERROR,
+ "passmgr: warning: your password appears longer (%d) than expected (%d)\n",
+ strlen(password_ptr), 31);
+ password_ptr[31] = '\0';
+ }
return (password_ptr);
}
}
diff --git a/wmbiff/test_wmbiff.c b/wmbiff/test_wmbiff.c
index 911f5c6..a279e9a 100644
--- a/wmbiff/test_wmbiff.c
+++ b/wmbiff/test_wmbiff.c
@@ -53,6 +53,10 @@ int test_backtickExpand(void) {
return(retval);
}
+#define CKSTRING(x,shouldbe) if(strcmp(x,shouldbe)) { \
+printf("Failed: expected '" #shouldbe "' but got '%s'\n", x); \
+ return 1; }
+
/* return 1 if fail, 0 if success */
int test_passwordMgr(void) {
const char *b;
@@ -103,7 +107,7 @@ int test_passwordMgr(void) {
return(1);
}
printf
- ("SUCCESS: expected 'abcdefghi1abcdefghi2abcdefghi3ab' got '%s'\n",
+ ("SUCCESS: expected 'abcdefghi1abcdefghi2abcdefghi3a' got '%s'\n",
b);
/* try overflowing the buffer */
@@ -117,7 +121,7 @@ int test_passwordMgr(void) {
return(1);
}
printf
- ("SUCCESS: expected 'abcdefghi1abcdefghi2abcdefghi3ab' got '%s'\n",
+ ("SUCCESS: expected 'abcdefghi1abcdefghi2abcdefghi3a' got '%s'\n",
b);
/* make sure we still have the old one */
@@ -151,9 +155,6 @@ int test_passwordMgr(void) {
return(0);
}
-#define CKSTRING(x,shouldbe) if(strcmp(x,shouldbe)) { \
-printf("Failed: expected '" #shouldbe "' but got '%s'\n", x); \
- return 1; }
#define CKINT(x,shouldbe) if(x != shouldbe) { \
printf("Failed: expected '" #shouldbe "' but got '%d'\n", x); \
return 1; }
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git
More information about the Pkg-wmaker-commits
mailing list