summaryrefslogtreecommitdiff
path: root/user/chntpw/chntpw-110511-robustness.patch
diff options
context:
space:
mode:
authorCyberLeo <cyberleo@cyberleo.net>2020-06-12 23:45:55 +0000
committerA. Wilcox <awilcox@wilcox-tech.com>2020-06-12 23:45:55 +0000
commit8a9860462fd1ae57861b93426c49df0396145832 (patch)
tree4f18c34d7301a6720010f64e6f772cb50780df86 /user/chntpw/chntpw-110511-robustness.patch
parentbe87f4ccc042f1b8a9db033ff5f52692b3138bc2 (diff)
downloadpackages-8a9860462fd1ae57861b93426c49df0396145832.tar.gz
packages-8a9860462fd1ae57861b93426c49df0396145832.tar.bz2
packages-8a9860462fd1ae57861b93426c49df0396145832.tar.xz
packages-8a9860462fd1ae57861b93426c49df0396145832.zip
user/chntpw: new port
Diffstat (limited to 'user/chntpw/chntpw-110511-robustness.patch')
-rw-r--r--user/chntpw/chntpw-110511-robustness.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/user/chntpw/chntpw-110511-robustness.patch b/user/chntpw/chntpw-110511-robustness.patch
new file mode 100644
index 000000000..ea2363f34
--- /dev/null
+++ b/user/chntpw/chntpw-110511-robustness.patch
@@ -0,0 +1,39 @@
+--- chntpw-110511.orig/ntreg.c 2011-05-11 12:33:56.000000000 -0700
++++ chntpw-110511/ntreg.c 2011-12-18 17:09:06.290818997 -0800
+@@ -190,14 +190,18 @@
+
+ int fmyinput(char *prmpt, char *ibuf, int maxlen)
+ {
+-
++ int len;
+ printf("%s",prmpt);
+
+ fgets(ibuf,maxlen+1,stdin);
++ len = strlen(ibuf);
+
+- ibuf[strlen(ibuf)-1] = 0;
++ if (len) {
++ ibuf[len-1] = 0;
++ --len;
++ }
+
+- return(strlen(ibuf));
++ return len;
+ }
+
+ /* Print len number of hexbytes */
+@@ -4119,6 +4123,14 @@
+ closeHive(hdesc);
+ return(NULL);
+ }
++
++ if (r < sizeof (*hdesc)) {
++ fprintf(stderr,
++ "file is too small; got %d bytes while expecting %d or more\n",
++ r, sizeof (*hdesc));
++ closeHive(hdesc);
++ return(NULL);
++ }
+
+ /* Now run through file, tallying all pages */
+ /* NOTE/KLUDGE: Assume first page starts at offset 0x1000 */