diff options
| author | Nils Philippsen <nils@redhat.com> | 2013-10-29 13:14:18 (GMT) |
|---|---|---|
| committer | Nils Philippsen <nils@redhat.com> | 2013-10-29 13:14:18 (GMT) |
| commit | d35d6326cb00fcbb19b41599bdff7faf5d79225e (patch) | |
| tree | 6ff321e720ba3654537175ffeba0fa30c7e68ea4 | |
| parent | 3b96baef65ea6c315937f5cd2253c6b6c62636d8 (diff) | |
pixmap: omitting curly braces considered harmful
The break being outside of the else block effectively made an if clause
out of the while loop. This caused long hostnames to not be shortened
sufficiently which subsequentely made strcpy() write beyond buffer
boundaries.
| -rw-r--r-- | backend/pixma_bjnp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/backend/pixma_bjnp.c b/backend/pixma_bjnp.c index 3046e9d..a1730ad 100644 --- a/backend/pixma_bjnp.c +++ b/backend/pixma_bjnp.c @@ -364,11 +364,13 @@ determine_scanner_serial (const char *hostname, const char * mac_address, char * /* if this is a FQDN, not an ip-address, remove domain part of the name */ if ((dot = strchr (copy, '.')) != NULL) { - *dot = '\0'; + *dot = '\0'; } else - strcpy(copy, mac_address); - break; + { + strcpy(copy, mac_address); + break; + } } strcpy( serial, copy ); return serial; |
