ae1d259eb6
Signed-off-by: Anton Arapov <anton@redhat.com>
24 lines
832 B
Diff
24 lines
832 B
Diff
diff -up microcode_ctl-1.17/microcode_ctl.c.getopt microcode_ctl-1.17/microcode_ctl.c
|
|
--- microcode_ctl-1.17/microcode_ctl.c.getopt 2011-12-22 13:15:55.073783568 +0100
|
|
+++ microcode_ctl-1.17/microcode_ctl.c 2011-12-22 13:14:22.000000000 +0100
|
|
@@ -151,7 +151,8 @@ int main(int argc, char *argv[])
|
|
break;
|
|
|
|
case 'd':
|
|
- strcpy(device, optarg);
|
|
+ strncpy(device, optarg, sizeof(device));
|
|
+ device[sizeof(device)-1] = '\0'; /* ensure null terminated */
|
|
break;
|
|
|
|
case 'u': /* do a microcode upload */
|
|
@@ -160,7 +161,8 @@ int main(int argc, char *argv[])
|
|
|
|
case 'f': /* set microcode file to optarg and upload */
|
|
upload++;
|
|
- strcpy(filename, optarg);
|
|
+ strncpy(filename, optarg, sizeof(filename));
|
|
+ filename[sizeof(filename)-1] = '\0'; /* ensure null terminated */
|
|
break;
|
|
|
|
case '?':
|